homework

Making a program timer-based rather than frame-rate dependent?

I have a game engine to work on as part of a class. Currently, its rendering is frame-rate dependent and one requirement is to move to a timer-based dependency. I am not sure how to determine where it is relying on frame-rates. I'm not sure what to look for. I realize I'm going to need to somehow incorporate a timer (GetTickCount?) to...

C++ compile error

#include<string> using namespace std; int main(){ const int SIZE=50; int count=0; ifstream fin("phoneData.txt"); ofstream fout("phoneList.txt"); string firstName, lastName, phoneNumber; if (!fin){ cout<<"Error opening file. program ending."<<endl; return 0; } while (count<SIZE && fin>>phoneNumbe...

insert a hyphen into a string C++

i have an array of strings of phone numbers, and i have to insert hyphens into them. what string function should i use, and how? thanks. :D ...

How do I create an algorithm that calculates the factors of an integer in C#?

The algorithm I need to come up with is one that computes all the factors for a user-entered number, for example the user would enter "50" and the program would display all the factors of fifty which are: 1, 2, 5, 10, 25, 50. This program would need to work for all positive integer values. Would anybody be willing to show me how to ...

Traversing/Setting L and RChild index's in complete Binary Heap C++

Hello, I used a binary heap concept to insert elements in my items array: void BST::insert(const data &aData) { int slot = size + 1; if ( size >= maxSize ) this->reallocate(); while ( slot > 1 && aData < items[slot / 2 - 1].theData ) { items[slot - 1] = items[slot / 2 - 1]; slot = slot / 2; } ...

middle of linked list

how to find the middle of the linked list when we are not informed of its size and it must be performed using only one loop and only one pointer. ...

Does this program grammar only recognize variables with the name 'ID'?

I need to make a scanner in lex/flex to find tokens and a parser in yacc/bison to process those tokens based on the following grammar. When I was in the middle of making the scanner, it appeared to me that variables, functions, and arrays in this language can only have the name 'ID'. Am I misreading this yacc file? /* C-Minus BNF Gram...

Need help on getArea() function

Hi, I'm trying to calculate the area of the circle and the rectangle by using the existing data (radius ,width, and height). But i have some errors, i hope you can help me fix it. #include <iostream> #include <vector> #include <string> using namespace std; class Shape { public: virtual void Draw () = 0; virtual void MoveTo (int ...

How to return the index of ascii char in C

So you have Table mapping the 26 ascii characters from the English alphabet to their corresponding morse code strings typedef struct a_look_tab { char table[asciiNum][MORSE_MAX+1]; } ALookTab; and asciiNum is the 0 for a, 1 for b, and so on. how to return an index (int) that is the index of the morse char. So what we are doing...

How to turn this into a parser

If I just add on to the following yacc file, will it turn into a parser? /* C-Minus BNF Grammar */ %token ELSE %token IF %token INT %token RETURN %token VOID %token WHILE %token ID %token NUM %token LTE %token GTE %token EQUAL %token NOTEQUAL %% program : declaration_list ; declaration_list : declaration_list declaration | declarat...

How to determine whether two list have same element in prolog?

How to determine whether two list have same element in prolog? If i have two list A and B, i want to know whether they have the same element. ...

Prime number generator in C

Where can I find a prime number generator in C? ...

Worst case running time (Big O)

Hi every one. I have this question, and I don't know how to solve it, because I don't understand it. :( The question is: Programs A and B are analyzed and are found to have worst case running times no greater than 150n log n and n2, respectively. Answer the following questions: i) Which program has the better guarantee on...

Modify the main screen so that all controls resize Proportionally when the form is resized

Hi All I need help in acomplishing this in wpf : "Modify the main screen so that all controls resize Proportionally when the form is resized" Thanks Marius ...

Look-up tables in c

I have this look up table : char *table[ascii][morse]; where ascii is an int (representing an ascii letter) and morse is a string of length 4 + 1 ( to add the null). It is a look up table in a way where you ask for letter 0 = a and it should return the morse represntation of it. if I have a ..-. (for example) in a file. and i want to...

I have an algorithm problem having to do with scheduling teams in rotation as fairly as possible.

I have a project for school where I have to come up with an algorithm for scheduling 4 teams to play volleyball on one court, such that each team gets as close to the same amount of time as possible to play. If you always have the winners stay in and rotate out the loser, then the 4th ranked team will never play and the #1 team always w...

string program for ice cream shop (Edited again)

With the assistance of others, I have redone the code from scratch due to them pointing out numerous errors and things that wouldn't work. Thus I have changed the code massively. I have the program working other than two formatting settings that I can't figure out how to get to work. I need to only print "DAILY SCOOP REPORT" once at ...

naming a finance management / tracking application

I am about to start develop a finance/expenses tracking/management/statistics webapplication, somewhat similar to xpenser.com , mint.com (except bank integration), for a college project and I am looking for a name credit will be given in the documentation if the name will be used if this turns later into a real-life project the name wi...

C++ segmentation fault when trying to output object functions

I am attempting to output functions common to a set of objects that share a base class and I am having some difficulty. When the objects are instantiated they are stored in an array and then I am attempting with the following code to execute functionality common to all the objects in this loop: if ( truck <= v ) // all types of truck...

newbie needs help i can't find whats wrong. i enter num and it stops

/********************************************************************* *Program Name : CSC 110 - 003 Store Unknown Number of Values *Author : Anthony Small *Due Date : Nov\17\09 *Course/Section : CSC 110 - 003 *Program Description: Store Unknown Number of Values in an Array * *BEGIN Lab 7 - CSC110-003 Store ...