How do I copy/find data, display records in uppercase, and find averages using void function? I'm not sure if I'm doing it right either. Main problem is finding uppercase in display, do I do toupper(c) ??
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
constint N=5;
struct RECORD
{
string Name;
int Age;
float Gpa;
};
RECORD p[N];
void CopyRecords (string filename, RECORD p[N]);
void Display (RECORD x[]);
void AgeGpaAverage(int N[]);
int main()
{
int AgeAve;
float GpaAve;
//Read data from this file into array p
CopyRecords("data2.txt",p);
//Display all records
Display(p);
//Compute age and GPA average
AgeGpaAverage(p, AgeAve, GpaAve);
//Terminate Program
system ("pause");
return 0;
}
void CopyRecords (string filename, RECORD p[N])
{
ifstream f;
f.open(filename, ios::in);
for(int i = 0; i <=5; ++i)
{
f >> p[i].Name;
}
}
void Display (RECORD x[])
{
for (int i = 0; i < N; ++i)
cout << x[i].Name << " " << x[i].Age << " " << x[i].Gpa << endl;
}