hey im now starting prog in c++ n im being honest- im REALLY flustered
i have to create a program to get information from a user, put the info to a file, create another program to read from that file, calculate total scores of x amount of students n grade and output to the screen.
i have the parts about getting the info from the user and putting it into a file down...kinda ( there is no space between the variables, and its the loop is not working). i do not know how to ready diff types of data on one line (str, int and double) from the file and into the other prog. im so lost!
here's what i have so far:-
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
main ()
{
ofStream outFile;
outFile.open ('records.dat');
string firstName, lastName;
int count, sc1, sc2, sc3, sc4, sc5 = 0;
while (count <= 5);
{
cout << "\nEnter student's first name: "\n";
cin >> firstName;
outFile << firstName;
cout << "Enter student's last name: "\n";
cin >> lastName;
outFile << lastName;
cout << "Enter 5 scores (of 10 or less) with spaces: \n";
cin >> sc1 >>sc2 >>sc3 >> sc4 >> sc5;
count ++;
}
return 0
}
(wondering if an array would have worked?)
this is just the first program (decided that i probably should work on 1 at a time)