jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Pop int Counter::nCounters; at the top of your counter.cpp file.
http://www.cs.loyola.edu/~lawrie/CS301/F03/StaticClassMembers.htm

Also, you don't need to include your cpp file in your h file.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

He/she is addressing the 3x3 array members by pointers and setting them to an intermediate variable so that when the input is written to said intermediate it will be written into the array. I agree with your point I don't know what prohibits setting a[0][0] to a value directly, etc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Actually, take the final average calculation (average = sum/5) _outside_ of the for loop otherwise you'll be calculating it each time.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was initially thinking to tell you to use a foreach (should look them up anyway they are useful) but since you are accessing the next element in the list it's not a valid option. properties.Count will give you the information for the size of the list so you can use that in a regular for loop. You're not doing any list editing in this loop but the need to remove items mid-loop is another reason to stick with the regular for loop.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In main set max = findMax(grade); I had missed that before, but if you don't have a variable to return your function to the value is lost.

All of your post editing is getting confusing I'm not sure where you are in the chronology.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

int findMax(int [][20]) needs to be int findMax(int grade[][20]) Definitions always need the identifier, declarations do not.
There's no identifier there so the compiler reflects a mismatched brace somewhere even though there isn't.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

that worked! inside the else block i had to set ptr=first; instead of *ptr=first;

Sorry about that. I was going to compile an example to make sure I told you that correctly and I got side tracked.

Anytime you have a set of braces a new scope is set up, meaning (among other things) that anything that is declared on the inside is not visible outside. But anything visible outside is visible inside, so you could have initialized your variable outside of the else statement. I was just trying to help you keep your code together. The thing about the braces is, once you close that scope, anything declared inside disappears (just like with functions and local variables). So you were trying to return something that no longer existed.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Declare Node<L>* ptr; inside your method but outside the else block. Then inside of else set *ptr = first; You might need to change what you return but I'm not absolutely sure.

MooAndStuff commented: Solved my problem =) +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

no, like wingless said a+1-a+3 not equal to a+1-(a+3)
I'm not sure what your assumptions are...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See http://www.cplusplus.com/reference/iostream/manipulators/setw/
That way the widths of your fields will be constant and you can use your ostream directly without all that mildly stressful string manipulation.

yatman commented: excellent help! +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Namespaces are important, but for the sake of a school assignment you could probably put using std::cout; and using std::endl; instead. Then you'd have to specify for the std::ofstream , etc. But I do concede to your point Stu and agree that good habits are important at any stage of the game.

StuXYZ commented: good comment on using (well you agreed with me :) +2
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

But why does your function return an int if you want it to return a string? Was your assignment given that way? Just saying it doesn't make much sense. If you need to return a string, just change the return type of the function string myName() { etc. }

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

First, declare ofstream report; within main() so it's not global. Then, for your function output_info, pass report in by reference (so you'll have to change your declaration of output_info to report this). Make sure you do the opening of your file within main() first before you pass it into anything.
Now anywhere there is a cout at the present (so cout << "ID number:"; becomes report <<"ID number:"; . Any other functions that need it, do the same thing, pass that ofstream report in by reference.

The direction of your << or >> operator should reflect whether you are taking data into a variable from a stream or outputting to a stream.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The main function is supposed to return a status to the invoking program (e.g., the operating system) so when people have declared main() as returning an int and they say return 0; they really mean that the program executed successfully (there are other error codes used in specific circumstances where the execution has been interrupted). It is "doomed" because a C++ program abiding by the standard should have a main returning int. void main() is outdated.

For your second question, yes, but it's slightly more complicated than in C#. You still need a collection of some sort, but your collection must of the Standard Template Library variety (e.g., vector). Check out http://www.cplusplus.com/reference/algorithm/for_each/ to see all the requirements.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

With no braces,{}, your while loop is only getting the statement directly underneath it. Start there. You don't want to return a true or false from main as your return type for main is an integer but also doing so will halt your program. Instead, after your if statement, set a variable (so initiate it as false at the top and then set it to be true once your condition occurs) that you have defined under int ctr; (really you could declare it anywhere outside of the while loop and within main).
Then use your if statement to set this boolean variable if the value is out of range. Then make another boolean for values over 500 and yet another for those under 10.

Don't be so discouraged, programming like anything else takes time to work on and improve.

snehil_khanor commented: nice reply.. +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

you can also write using std::cout; at the top to cover every time you use it (or using namespace std; , but that's not encouraged as it defeats the purpose of having a namespace)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You're very welcome, glad I could help.

It might be a safe choice to put in i < min(testData.size(),trainingData.size()) for your for loop condition to make sure you don't get a mismatch.
If you wanted to get fancy, and with more data, you could take a random sample of your training set equal to the size of the testing set. That's the only way I can think of offhand.

bpt0004 commented: Your a LifeSaver!!! +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

you are assigning your temps TO the record.totalpoints when the temps haven't been assigned any value.

also, your temp1,temp2,temp3 are not in scope with the class_avg function. pass them in as arguments. you should only need one while loop, if there is just a set number of records, use a for loop.

it's easy to get overwhelmed, but just take a step back and sketch it out on a piece of paper