:o When I start the program it just spits out a continuous line of numbers; Can anyone give me any suggestions, OR better yet, just tell me how so I can start my Thanksgiving break early? :o

``````/* Program Description: The program will read a file named Scores.dat, and
will show the scores of a student and their average
Author: Eric Martin
Date: 24 November 2004 */

#include <iostream>
#include <string>
#include <conio.h>
#include <fstream>
using namespace std;

int main () {
// Declare
ifstream InFile;
int NumScores;
int Weights [5];
int Scores;
int TotalScore;
int StudentName;
float AverageScore;
// Initialize
InFile.open("c:/Scores.dat");
// Solve
// Get Number of score
InFile >> NumScores;
// Get wight of scores
for (int I = 0; I < NumScores; I++){
InFile >> Weights [I];}
// Get student name and scores
while (!InFile.eof()){ InFile >> StudentName;
TotalScore = 0;
for (I = 0; I << NumScores; I++) {InFile >> Scores;
// Apply weights and compute final scores
TotalScore = TotalScore + Scores * Weights [I];}
// Figure out letter grade
AverageScore = (float) TotalScore / 100;
cout << StudentName << ' ' << AverageScore << endl;}
// Wrapup and close
InFile.close();
cout << endl;
getch();
return 0;
}``````

I'm not real sure where to indent.. How does this look?

``````/* Program Description: The program will read a file named Scores.dat, and
will show the scores of a student and their average
Author: Eric Martin
Date: 24 November 2004 */

#include <iostream>
#include <string>
#include <conio.h>
#include <fstream>
using namespace std;

int main () {
// Declare
ifstream InFile;
int NumScores;
int Weights [5];
int Scores;
int TotalScore;
int StudentName;
float AverageScore;

// Initialize
InFile.open("c:/Scores.dat");

// Solve
// Get Number of score
InFile >> NumScores;
// Get wight of scores
for (int I = 0; I < NumScores; I++){
InFile >> Weights ;}
// Get student name and scores
while (InFile >> StudentName){
TotalScore = 0;
for (I = 0; I << NumScores; I++) {InFile >> Scores;
// Apply weights and compute final scores
TotalScore = TotalScore + Scores * Weights ;}
// Figure out Average
AverageScore = (float) TotalScore / 100;
cout << StudentName << ' ' << AverageScore << endl;}

// Wrapup and close
InFile.close();
cout << endl;
getch();
return 0;
}
``````

I << NumScores?????

And its better if u let us know how the data in the file are arranged.

it's also better to use a descriptive topic and not demand instant attention as that's extremely rude.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.