The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hi, I have to write a C++ program using txt file, and I really need some help.
score.txt is givien, with each line containing 3 test scores of each students.
Bob 66 55 60.5
Robby 46 32 98
Anne 83 45.5 50
Student names should be stored in an array of strings, and their marks should be in a 2D array.
I can select two options, 1 or 2, and each option should perform different tasks.
Â
Option 1:
I should write a program to sort the records in ascending order of the column number I input, and output the results as a table. 0 is student name, 1, 2, 3, 4 each represent test 1, 2, 3, and 4.
Â
For example, if I type 0, it should print a table like this:
Anne      83     45.5    50
Bob        66     55      60.5
Robby    46    32        98
if I type 2, then it should be like:
Robby    46    32        98
Anne      83     45.5    50
Bob        66     55      60.5
Â
Option 2:
I should be able to update the score, and write the updated score table sorted by student name to file new.txt.
I should input student name, test number, and change the score.
Â
For example, if I type like this:
Name: Anne
Test: 3
New mark: 100
Â
then new.txt should be:
Anne      83     45.5   100
Bob        66     55      60.5
Robby    46    32        98
I just started to learn C++, so I really need help.
Thanks.
Â
Bob 66 55 60.5Robby 46 32 98Anne 83 45.5 50
Attachments: