| | |
I'm new in this site and also in c++, please help me
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2006
Posts: 3
Reputation:
Solved Threads: 0
Hi everyone,
First I want to say hello to everybody in this site and I hope that you'll welcome me as one of your nice members :o .
I've just started learning C++ language, and now I have to make a small program that counts the average grade for a number of homeworks for a number of students. This program should count only the big grades and leaves the last small grade, like if the user entered (56, 67, 98, 45, 67, 46, 89) the program would add them all together except the last small one which is 45, and then devide them by their number 6 and not 7. I have to put this inside a loop and also I need to use an if statement. I know how to do everything, but I just need to know how to make the part when the program should look for the smallest grade and ignore it. Please help guys and thanks inadvance
First I want to say hello to everybody in this site and I hope that you'll welcome me as one of your nice members :o .
I've just started learning C++ language, and now I have to make a small program that counts the average grade for a number of homeworks for a number of students. This program should count only the big grades and leaves the last small grade, like if the user entered (56, 67, 98, 45, 67, 46, 89) the program would add them all together except the last small one which is 45, and then devide them by their number 6 and not 7. I have to put this inside a loop and also I need to use an if statement. I know how to do everything, but I just need to know how to make the part when the program should look for the smallest grade and ignore it. Please help guys and thanks inadvance
•
•
Join Date: Dec 2005
Posts: 43
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by almared_6
ya that's ok with me, but how do I get a record with the smallest? That's the question that I'm trying to find an answer for.
qty = 0; // why zero here and not at the beginning? food for thought.
Now loop though each entry comparing new entry to smallest.
Remember to keep track of the qty of entries.
if newentry is less {
...
} else {
...
}
average = total/qty;
That should be enough to get you started.
•
•
•
•
Originally Posted by almared_6
ya that's ok with me, but how do I get a record with the smallest? That's the question that I'm trying to find an answer for.
The first time he calls out a number, you remember that number, because it's the smallest number he's called so far.
Second time, you ask yourself "is this smaller than the smallest number?"
if the answer is yes, you remember that one
if not, you wait for the 3rd number... etc.
![]() |
Similar Threads
- Streeeeetched the site (DaniWeb Community Feedback)
- PC Mod Kingdom 3.5 (Geeks' Lounge)
- site promotion (DaniWeb Community Feedback)
- Review this site!! (Geeks' Lounge)
- This site going very very slow (DaniWeb Community Feedback)
Other Threads in the C++ Forum
- Previous Thread: Snmp Mib
- Next Thread: Word length sorting
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int integer java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets







.... as i used to do such mistakes a lot!