Click Here

answer this please...

If you want to ask a question here, please ask it here.

I agree with vmanes in that you should post your questions here if you want an answer here. But since i just had some bad news, i could do without all the hassle...

Seems to me that you missed a pair of curly braces {} in the last for:

...
for(int a=0; a<n; a++)
{
    cout<<"\n\n\n"<<name[a];
    for (int i=0;i<size;i++)
    { //HERE
        cout<<"\t "<<num[i];
        cout<<setw(33)<<" = "<<sum;
    } //AND HERE
}
cout<<"\n\n";
system("PAUSE");
return 0;
...

That's why the output was a single grade, instead of the list of grades.

Double check your code, and try to indent it better, so that debugging becomes easier.

still the last grades is going to pop out.. not the list of grades.. can you trouble shoot this???

Alongside the missing braces mentioned by Nichito there are a few other problems in your existing code:
Your one dimensional char array 'name' will only hold a single name up to 19 characters long (the final place in the array should be reserved for a null!). 'name' will not hold multiple names. So you have a problem right there. Your code to get the users names will not work in the way that you think it does.

As this is C++, either use an array or a std::vector of std::strings to store all of the students names. Otherwise, if you haven't covered using std::library containers and/or you are only allowed to char arrays, you'll need to use a 2 dimensional char array to store all of the student names.

Then there is your array called num (which is where you're hoping to store students scores) which is a one dimensional array and has a hard-coded size of 5. The reason you are only seeing one set of scores is because your array of scores (num) is completely over-written each time through the nested for loop inside the first for loop in your code. So at the end of the program you will only see the last students results. You need to use a two dimensional array in order to store all of the students scores.

An additional problem with your existing code for getting the students scores is that it is possible that a user could enter a number greater than 5 when prompted for the number of 'quizzes'. So if the user enters a number greater than 5, you will end up overstepping the bounds of the array (which has been hardcoded to a size of 5). Which is also rather bad!

So in order to store all of the students names and scores, if you aren't going to use std::library components, then name and num both need to be two dimensional arrays.

And then there is your average calculation, which only calculates the average for a single user (the last one entered).

So there are a number of problems with your code that you will need to fix!

@jasonhippy, can you help me fix my program please? for i was just a beginner for this c++ and haven't yet expanded my peice of mind to cover with this program.our instructor just lend us use a personal comuters then havent even giving some clues for that problem. can you make the program for me? if its just okay with you?,, i would really appreciate if you will help?.thank you.

PLEASE DO NOT ASK US TO SOLVE YOUR HOMEWORK PROBLEMS! This is cheating, pure and simple! The other posters have given you great hints about what may be your problem(s), yet you want them to finish the work... If I could, I'd give you a great big dope slap upside your head!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.