homework

math.sqrt vs. Newton-Raphson Method for finding roots in c#

Hi, I'm doing a homework project that requires this: Below you will find the code that I have written to compute the square root of a number using the Newton-Raphson method. Include it in your project. For this project your job will be to write a test harness that tests the code that I have written. Carefully read the method prologue to...

Help with C program(gcc) in Linux

Hi... I have a project for my college but unfortunately, I struggle in programming, apart from simple C programs. Anyway, the way I see it, I think the code I need should be around 20-30 lines, so if somebody can provide me some help I'll be really grateful. Here is the project: A parent process will produce 10 random integer numbers (...

reversing an array of characters without creating a new array

write a program that enters an array of characters from the user and reverses the sequence without creating a new array ...

Regexp to exclude 101 and 110.

What is a regexp that accepts everything over the language {0,1} but has no substring 110 or 101? Accept: 111111 000011111 100001000001001 010 1 Reject: 100110 010100 123 Edit: Per comments on answers below, this question is asking for a formal regular expression. ...

what is meant by cloud computing? give some examples

what is meant by cloud computing? give some examples ...

how to check whether the number ends with 9 or not in numbers 1to 100

I want to print the numbers from 1 to100 in the format 1-------------9 10------------19 20-------------29 30--------------39 40-----------49 50-----------59 60-----------------69 70---------------79 80---------------89 90-----------------99 ...

What are "Code Listing"

For a university assignment in Java the specification requires that Code Listings: in 10-point Courier New typeface, and in Landscape mode if you have lines that are too long to fit into Portrait mode. are included in the documentation. The term seem ambiguous to me and it's a bit late to consult my tutor, how would you defi...

horner's rule C++

While trying to evaulate polynomials using Horner's Rule I have a sample code segment like so: int Horner( int a[], int n, int x ) { int result = a[n]; for(int i=n-1; i >= 0 ; --i) result = result * x + a[i]; return result; } I understand that a is an array of coefficients and that x is the value that I would like...

Number of levels in a tree in LISP

An n-ary tree is memorised in the following way: (node (list-subtree-1) (list-subtree-2) ...) As an example, the tree A / \ B C / \ D E is represented as follows: (A (B) (C (D) (E))) Return the number of levels of a tree The problem is that I am only allowed to use the following functions: null, car, cdr, equal, atom, ...

Using point sprites with direct x. what steps need to be taken?

This is still an outstanding issue. I am trying to get a point sprites system workign render a sun in my world. I noticed another user asking a similar question (with the same code, presumably from my class :) ) but they were not able to complete this. My current code for this is as follows: float fPointSize = 10.0f,fPointScaleB =...

What does the brackets mean in python: table[r][pos+i]?

This is the full code: def checkRow(table, r, pos, word): # done for you! for i in range(0, len(word)): if table[r][pos+i] != word[i]: return False return True I know the bracket mean the index value (in this case r some value of the index table) but what does a bracket next to another bracket mean? (table[...

regex in for loop

hi how to use regex with for loop in python example data abc 1 xyz 0 abc 2 xyz 1 abc 3 xyz 2 how to write regex for something like below for i in range(1, 3): re.match(abc +i xyz +(i-1)) Thanks in advance ...

very simple question about interface

interface IA : interface IB { ... } so IB is the parent interface of IA, IA is the _ of IB. What should be put in the blank? sub-interface? ...

java int comparation

How does Java know/evaluate the comparison of two int values; for example: int a=5; int b=10; How does it evaluates whether a > b or a == b or a < b Please give an elaborate explanation. ...

How do I merge two arrays having different values into one array?

Suppose you have one array a[]=1,2,4,6 and a second array b[]=3,5,7. The merged result should have all the values, i.e. c[]=1,2,3,4,5,6,7. The merge should be done without using functions from <string.h>. ...

(c#) NullReferenceException??? I've got a constructor what's going on?

I am trying to write code for an assignment for the c# intro class at my college but am ahead and am running into problems. I am getting a NullReferenceException when i run the program - i think the problem is coming from the fact that i am creating a 'Line' which contains the 'Point' class... i have tried for 3hrs to fix this - any help...

Data Destruction In C++

So, for class I'm (constantly re-inventing the wheel) writing a bunch of standard data structures, like Linked Lists and Maps. I've got everything working fine, sort of. Insertion and removal of data works like a charm. But then main ends, my list is deleted, it calls it's dtor and attempts to delete all data inside of it. For some r...

C# Simple File I/O

I'm trying to write a program that does this: In this exercise exam scores for a class of students is stored in a file. You are to write a program that successfully opens the file, reads in the exam scores, finds the average score, the highest score, and the lowest score, and prints these out. The average score should be printed with 2 ...

Constant Pointer / structs

In my programming class, we have struct Time { int hours, min, sec; } We are to create a method to compute the difference between two times: Time *timeDiff(const Time *t1, const Time *t2) I thought I could create the time difference by getting everything in seconds, and then subtracting the two values, but it seems like extra wo...

How to find out what was the last reason to tokenize

I am using the following code to tokenize the string in C and using " ," to make tokens but i wanted to know when it make token of string when " " came and when "," occur in the string. char *pch; pch = strtok(buffer, ", "); while (pch!=NULL) { printf("%s\n", pch); pch = strtok(NULL, " ,"); } ...