![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Problem about using class member function to read text fileThe question required to read some values from a text file. a example of text file is following(Student ID, 3 Assigments scores and final exam score);
s0000001 12 12 12 170 s9100002 9 7 10 135 s8000001 10 10 10 179 s9005004 6 9 6 150 s7000001 10 10 10 136 Now , I have a header file below,but I have no idea how to write member function to read those values from text file. CPP / C++ / C Code:
Asking for anyone can help!! cheers! Last edited by admin : 15-Sep-2007 at 08:16.
Reason: Please insert your C code between [cpp] & [/cpp] tags
|
|
#2
|
|||
|
|||
Re: Problem about using class member function to read text fileQuote:
CPP / C++ / C Code:
Just for curiosity, I don't get this part CPP / C++ / C Code:
Or does it mean that total score = 30 * (assSum / 30) + 70 * (exam / 180)? Last edited by Kimmo : 14-Sep-2007 at 14:25.
|
|
#3
|
|||
|
|||
Re: Problem about using class member function to read text fileKimmo
The question is to get and calculate each student's final score which including 3 assignment scores(contributes 30%) and final exam score(contributes 70). If total assignment score is greater than 30 , it will be counted 30, if less than 30 ,like 25 ,the total assignment score will be remain 25. The exam score will be scale down to 70, that means , 180 =70, 90=35. So the maximum of final score is still 100. I am confused how to write definition to get each assignment score and final exam score from a text file. I wrote some belwo ,but seems not corret. CPP / C++ / C Code:
Last edited by admin : 15-Sep-2007 at 08:17.
Reason: Please insert your C code between [cpp] & [/cpp] tags
|
|
#4
|
|||
|
|||
Re: Problem about using class member function to read text fileQuote:
Now when I look at that header file, it seems to me that the intention is not to read the data in a method. The intention is just to pass the data (sounds reasonable, no use making unitType a database manager.) So try something like this in your main() Code:
If the data in file is guaranteed to be ordered as you showed, then reading the data could be done with something like follows: CPP / C++ / C Code:
|
Recent GIDBlog
Welcome to Baghdad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PERL: Problem with Read from file | Reny | Miscellaneous Programming Forum | 1 | 07-Aug-2007 07:44 |
| Major newbie problem | cynack | MS Visual C++ / MFC Forum | 1 | 08-Apr-2007 11:25 |
| Hard drive/CPU Diagnoses Issues | binarybug | Computer Hardware Forum | 1 | 22-Jan-2007 19:23 |
| Database Program | goldfish | C Programming Language | 6 | 13-May-2006 13:12 |
| [Tutorial] Standard I/O | aaroncohn | C Programming Language | 20 | 27-Feb-2004 21:07 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The