homework

[C] manually continuing loops

I have a file where each line consists of some words and a number. I'd like to read the file, one line at a time, displaying just the words. Then the program should wait for a key press, and display the number on a certain key, and go on to the next line without displaying the number in the default case. My problem is, the only solution ...

java access modifiers

which access modifiers which when used with the method makes it available to all the class and subclasses within a package?? ...

Need help in making this star program using for loop in C

I am a beginner in C and want to create a program using for loop which gives the following output: * * * * * * * * * * * * * * * * * * * ...

replacing a particular pattern in a string with an auto incrementing number

I have a string like "Hello how Hello are Hello" I want to replace the number of times "Hello" occurs in the above string by an autoincrementing number. Like "1 how 2 are 3" "Hello" can occur any number of times ...

Easiest to code algorithm for Rubik's cube?

Edit: I should rephrase this, what would be a relatively easy algorithm to code in Java for solving a Rubik's cube. Efficiency is also important but a secondary consideration. Orig: What is the easiest algorithm to code for solving a Rubik's cube? It could be the least efficient but I am looking for something easy to code right now. ...

Java program which accepts a list of existing text files from command line arguments

Question: write a Java program which accepts s list of existing text files from command line args and concatenates the contents of all files in "Master.txt". It gives error while testing 4 endsWith(".txt"). Kindly correct it import java.io.*; class FileConcat { public static void main(String[] args) { FileOutputStream fout; FileI...

why 1 digit random numbers are also getting generated by the following code?

Private Sub Command1_Click() Dim x As Integer For x = 1 To 100 List1.AddItem (Int(100 * Rnd())) If ((Int(100 * Rnd())) >= 10) Then Print Else End If Next x End Sub ...

Homework: Triangle angle calculation all sides known

I know I should do my homework on my own but I simply cant get my homework to work the way I want it to: from __future__ import division import turtle import math def triangle(c,a,b,beta,gamma): turtle.forward(c) turtle.right(180+beta) turtle.forward(a) turtle.right(beta) turtle.left(beta+gamma) turtle.forward(b...

Why fwrite libc function is faster than write syscall?

Okay, this is for a homework; although I'm not requesting any help on the programming side. It's already done :) After providing the same program which reads a random generated input file and echoes the same string it readed to an output. The only difference is that on one side I'm providing the read and write methods from linux syscals...

ISR - Maximum Data Rate

The interrupt service routine (ISR) for a device transfers 4 bytes of data from the device on each device interrupt. On each interrupt, the ISR executes 90 instructions with each instruction taking 2 clock cycles to execute. The CPU takes 20 clock cycles to respond to an interrupt request before the ISR starts to execute instructions. Ca...

how can i check if Microsoft Office is installed?

I have to do it in C#. How can i check if Microsoft Office is installed? ...

Help me understand why page sizes are a power of 2?

Answer I need help with is: Recall that paging is implemented by breaking up an address into a page and offset number. It is most efficient to break the address into X page bits and Y offset bits, rather than perform arithmetic on the address to calculate the page number and offset. Because each bit position represents...

Java Constraints Library (JCL) problem: how to represent addition?

I have to solve a CSP logic problem using Java Constraints Library. For now I've managed to represent some constraints of the problem, most of them are based on "equals" and "not equals" binary constraints. My doubt is, how to represent an addition based constraint? Example: variable1 belongs to DomainA variable2 belongs to DomainB var...

Haskell function pattern-matching issues

I'm doing some homework and while I have some experience with SML, Haskell has some oddities. Consider this simple function: type Pos = (Int, Int) data Move = North | South | East | West move :: Move -> Pos -> Pos move North (x,y) = (x, y+1) move South (x,y) = (x, y-1) move East (x,y) = (x+1, y) move West (x,y) = (x-1, y) moves :: [M...

sorting number using easy68k

how to sort number in descending order by using easy68k? ...

Uber basic java question

How do i read a char from a user in the command line. I am familiar wit readInt() is there some thing like this for chars. please help this is for the stanford course i am taking online as part of stanford engineering everywhere over the summer and i need to finish soon before my high school term starts. Is there any way I can do thi...

Substring algorithm

Can someone explain to me how to solve the substring problem iteratively? The problem: given two strings S=S1S2S3…Sn and T=T1T2T3…Tm, with m is less than or equal to n, determine if T is a substring of S. ...

C-Strings in C++

I'm learning C++ for one of my CS classes, and for our first project I need to parse some URL's using c-strings (i.e. I can't use the C++ String class). The only way I can think of approaching this is just iterating through (since it's a char[]) and using some switch statements. From someone who is more experienced in C++ - is there a be...

Allocation memory for display

I am trying to create a graphics library... i need to int NewDisplay(Display **display, DisplayClass dispClass, int xRes, int yRes) { /* create a display: -- allocate memory for indicated class and resolution -- pass back pointer to Display object in display */ return SUCCESS; } How can i allocate memory to class and to t...

PHP maybe regex

OK, so I have a new project with me, it is basically on solving logical and reasoning type of problems. Like in maths you are given a figure and asked how many triangles are in it. What I have to do is. User enters a code and a word. example word -> example code -> aesxxasskmpaalee here if we remove certain characters, we can form exa...