homework

What is the return value of sched_find_first_bit if it doesn't find anything?

The kernel is 2.4. On a side note, does anybody knows a good place where I can search for that kind of information? Searching Google for function definitions is frustrating. ...

Intel Assembly Programming

class MyString{ char buf[100]; int len; boolean append(MyString str){ int k; if(this.len + str.len>100){ for(k=0; k<str.len; k++){ this.buf[this.len] = str.buf[k]; this.len ++; } return false; } return true; } } Does the above translate to: start: push ebp ; save calling ebp mov ebp, esp ; setup new ebp push esi ; ...

calculating frequency of a number in an Array

I have an array, scores[5][5] and it is filled with test scores. I need to find the most frequently occurring score and return it. ...

Printing a 2D array in C

how would I print a 2d array in c using scanf for user input, array called grid[ ][ ] and a for loop? say if the user types in 3 5, the output will be: ..... ..... ..... Here is the code that I have written so far (newbie here): #include <stdio.h> #define MAX 10 int main() { int grid[MAX][MAX]; int row, col; int i,j; ...

Problem with OOP Class Definitions

Hi, this is Oben from Turkey. I work for my homework in C++ and i have some problems with multiply definitions. My graph class ; class Graph{ private: string name; //Graph name fstream* graphFile; //Graph's file protected: string opBuf; ...

replacing elements horizontally and vertically in a 2D array

the code below ask for the user's input for the 2D array size and prints out something like this: (say an 18x6 grid) .................. .................. .................. .................. .................. .................. code starts here: #include <stdio.h> #define MAX 10 int main() { char grid[MAX][MAX]; int i,j,...

FILE* issue PPU side code

We are working on a homework on CELL programming for college and their feedback response to our questions is kinda slow, thought i can get some faster answers here. I have a PPU side code which tries to open a file passed down through char* argv[], however this doesn't work it cannot make the assignment of the pointer, i get a NULL. No...

Express any number as the sum of 4 prime numbers [Doubts]

I was give a problem to express any number as sum of 4 prime numbers. Conditions: Not allowed to use any kind of database. Maximum execution time : 3 seconds Numbers only till 100,000 If the splitting is NOT possible, then return -1 What i did : using the sieve of eratosthenes, i calculated all prime numbers till the specified n...

Find numbers whose sum of digits is 7 [PHP]

i have a question that i want to display the numbers up to 100 where the sum of their digits is 7. can any one help me suppos there is 25 . in ths 2+5=7 then it will be displayed. i have problem to break 25 as 2 and 5 ...

Sort data in C language

I need little help on following requirement, as I know very little about C syntax. I have data in a file like this 73 54 57 [52] 75 73 65 [23] 65 54 57 [22] 22 59 71 [12] 22 28 54 [2] 65 22 54 73 [12] 65 28 54 73 [52] 22 28 65 73 [42] 65 54 57 73 [22] 22 28 54 73 [4] Where values in bracket denotes the occurrence of that series. I ne...

C - Malloc or calloc...and how?

Hi...i have a text file where the first number defines the size of the arrays. I know that calloc or malloc can reserve memory, but how? this code: typedef struct alpha { int* size; char name; int tot; char line[60]; } ALPHA; fgets(line, 60, fp); tot = atoi(line); size = (int*)calloc(name, sizeof(int); Imagine that ...

Data Types and Structs

I'm reviewing for a test, and I am stumped by this question. Consider the following declarations: enum CategoryType {HUMANITIES, SOCIALSCIENCE, NATURALSCIENCE}; const int NUMCOURSES = 100; struct CourseRec { string courseName; int courseNum; CategoryType courseCategory; }; typedef CourseRec CourseLis...

Reversing a circular deque without a sentinel

Hey Stackoverflow I'm working on my homework and I'm trying to reverse a circular-linked deque without a sentinel. Here are my data structures: struct DLink { TYPE value; struct DLink * next; struct DLink * prev; }; struct cirListDeque { int size; struct DLink *back; }; Here's my approach to reversing the deque: void revers...

cannot convert from "void" to "int"

Cannot convert from "void" to "int" in C++ - anyone know why? is there a function i have to use? int calc_tot,go2; go2=calculate_total(exam1,exam2,exam3); calc_tot=read_file_in_array(exam); ...

(log(n))^log(n) and n/log(n), which is faster?

f(n)=(log(n))^log(n) g(n)= n/log(n) f=O(g(n))? ...

fwrite C programming

HI...i want to write something like this in a file, using fwrite fwrite("name is %s\n",name, 60, fp); but is not working, only write in the file the string. any idea? ...

This program runs but not correctly; the numbers aren't right.

this program runs but not correctly numbers arent right, i read numbers from a file and then when i am using them in the program they are not right.:brief decription of what i am trying to do can someone tell me if something doesnt look right. this is what i have to do: write a program that determines the grade dispersal for 100 studen...

Creating a spam list with a web crawler in python

Hey guys, I'm not trying to do anything malicious here, I just need to do some homework. I'm a fairly new programmer, I'm using python 3.0, and I having difficulty using recursion for problem-solving. I've been stuck on this question for quite a while. Here's the Assignment: Write a recursive method spam(url, n) that takes a url of a...

Vector insert() causes program to crash

This is the first part of a function I have that's causing my program to crash: vector<Student> sortGPA(vector<Student> student) { vector<Student> sorted; Student test = student[0]; cout << "here\n"; sorted.insert(student.begin(), student[0]); cout << "it failed.\n"; ... It crashes right at the sorted part...

haskell recursive function

Hello, Please help me with writing function which takes two arguments : list of ints and index (int) and returns list of integers with negative of value on specified index position in the table MyReverse :: [Int]->Int->[Int] for example myReverse [1,2,3,4,5] 3 = [1,2,-3,4,5] if index is bigger then length of the list or smaller then...