![]() |
|
#1
|
|||
|
|||
Calculating marks and displaying letter gradesHi,
The following things must be computed using C++, here goes: I am about to create a program that takes information from a text file. The text file will contain things such as student number, followed by the different marks that the student received. However there is a number displayed on the first line (4) that says how many assignments were passed in. ex: 4 123456 8 5 6 9 347687 10 10 9 9 132657 8 0 -1 10 273828 10 10 0 5 The first number is the student number, each other number divided by spaces is the marks received. Notice that there is a -1 in there. This would mean that there is a valid excuse for not handing in an assignment (which is easily put into an if and else statement) You must already know that the program will have to do this, ex: (8 + 5 + 6 + 9) / 4 (being the top line number) and if there is a -1 then -1 from the assignment number, making it 3. There can be more than one -1, but there has to be at least one mark for each student. From this there will be a traditional grade of : 95-100 A+ 90-94.9 A 80-89.9 A- 77-79.9 B+ 74-76.9 B 70 73.9 B- 67-69.9 C+ 64-66.9 C 60-63.9 C- 50-59.9 D 0 - 49.9 F then there should be output to a text file of the scores, something like this: 123456 100 A+ (just an example) 234344 0 F In a DIFFERENT file there should also be printed: number of students, average of class, and deviation for the class: stdDev = sqrt ( ((s1-avg)2 + (s2-avg)2 + (s3-avg)2 + ... + (sn-avg)2)/(n+1) ) Of course average has to be figured out before the standard deviation,so I will need to open the input file, read it, close it, then open it again. My question to all of you is: Could you give me a good way to format this program, and give me some hints and reminders, because I haven't gone this far into coding in C++ before. You will probably recognize that I'm starting this off slowly, and not coding until I have the floor plan. That's my purpose |
|||
|
#2
|
||||
|
||||
Re: Calculating marks and displaying letter gradesHi tyler,
Quote:
Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#3
|
|||
|
|||
Re: Calculating marks and displaying letter gradesQuote:
how would I get the number of lines? I realize it would involve using .get . but that's my limit. |
|
#4
|
||||
|
||||
Re: Calculating marks and displaying letter gradesYou can use >> operator for that.
For example, like this: CPP / C++ / C Code:
Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#5
|
|||
|
|||
Re: Calculating marks and displaying letter gradesthanks, I'll be fine now.
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The