#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <math.h>
#include <fstream>
using namespace std;
//pass in the parameters
void inputData(double score[],int type[], int max[], int size){
//open the input file
ifstream intput("X:\\Downloads\\lab4input.txt");
if (intput)
{
cout << "quizz grades my guy " << endl;
}
//In the while condition, add the instream variable
while (intput >> score[size] >> type[size] >> max[size])
{
size++;
}
//clsoe the file
intput.close();
}
int main() {
//Array to store the scores
double score[50];
//Array to store the types
int type[50];
//Array to store the max points
int max[50];
//Size
int size = 0;
inputData(score, type, max, size);
for (int i = 0; i < size; i++) {
if (score[i] == 1)
{
cout << "score [" << i << "]:" << score[i] << endl;
}
}
for (int i = 0; i < size; i++) {
if (type[i] == 1)
{
cout << "type [" << i << "]:" << type[i] << endl;
}
}for (int i = 0; i < size; i++) {
if (max[i] == 1) {
cout << "max [" << i << "]:" << max[i] << endl;
}
cout << type[i];
cout << max[i];
cout << score[i];
}
system(" pause");
return 0;
}
void inputData(double score[], int type[], int max[], int& size)
And please, learn to use code tags. It make reading your source much easier.
You can edit your post and add code tags:
http://www.cplusplus.com/articles/jEywvCM9/