English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

#include
#include
#include
#include
using namespace std;
int main()
{

int studentId[15];
int studentQuiz1[15];
int studentQuiz2[15];
int studentQuiz3[15];
int studentQuiz4[15];
int studentQuiz5[15];

ifstream infile("farhanafiona.txt");

cout<<"Student"<<" "<<"Quiz 1"<<" "<<"Quiz 2"<<" "<<"Quiz 3"<<" "<<"Quiz 4"<<" "<<"Quiz 5"<<" "<<"High"<<" "<<"LOw"<<" "<<"Average"< cout<<"Number"< int noofstudent=0;
while(noofstudent<15 && infile>>studentId[noofstudent] && infile>>studentQuiz1[noofstudent]&& infile>>studentQuiz2[noofstudent]&& infile>> studentQuiz3[noofstudent]&& infile>> studentQuiz4[noofstudent] && infile>>studentQuiz5[noofstudent])
{
cout< cout<
noofstudent++;
}

2007-03-27 16:52:20 · 1 answers · asked by n f 1 in Computers & Internet Programming & Design

1 answers

I don't know C++ but the strategy is something like this, whilst in your while loop add other variables, one that starts at 0 and another that starts at teh maximum possible score

minscore = 100
maxscore = 0

if currentscore < minscore { minscore = currentscore }
if maxscore < currentscore { maxscore = currentscore }

by the time you get to the end of your while loop, you will have the minimium score and maximum score

now also simply add up all scores as you go and divide them by the number to get the average

2007-03-27 17:00:24 · answer #1 · answered by teef_au 6 · 0 0

fedest.com, questions and answers