i got to do this for my class and i am a total noob!
i don't know what to do from this point on.
first, i need to use fstream to do this.
3
Tracy 80 91 67
Dana 0 66 44
Scott 50 41 64
Jamie 82 90 87
Jennifer 95 100 90
William 67 77 62
Wendy 90 96 84
Heather 80 91 86
John 100 100 99
here, i want the three to represent the number of score i have up here. is there any way to do it without using a char?
because i get like 51 when i use it as char.
also i want to be able to add these three numbers and divide them by three.
which means i need to read the name, and the scores differently.
i don't know how to!!!!
all i could use on fstream is like getline which gets the line where i want them to, but i can not do the math part of it.
here is what i have done so far.
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
char num;
int count;
int dashCount;
int scores;
float average;
string fileName;
string name;
ifstream myin;
cout << "Please enter the file name that contains the student records: ";
cin >> fileName;
myin.open(fileName.c_str());
myin.get(num);
cout << "there are " << num << " scores per studentn";
cout << endl;
cout << "Student name ";
count = 1;
while (count <= 3)
{
cout << "test" << count << " ";
count++;
}
cout << "final score graden";
cout << endl;
dashCount = count * 8 + 31;
count=1;
while (count<= dashCount)
{
cout <<"-";
count++;
}
cout << endl;
cout << endl;
while (myin)
{
getline(myin, name);
cout << name;
while (myin)
{
}
cout << endl;
}
cout << "The class average is " << average << endl;
cout << "There are " << << " studentsn";
myin.close();
return 0;
}
i can not use anything higher than fstream, iostream, while loop, if-then-else. i cant use fuctions either.
please help out quickly. i need to turn this in today!!!!