using namespace System; using namespace std; string sarray[300][8]; //hold all t
ID: 3533776 • Letter: U
Question
using namespace System;
using namespace std;
string sarray[300][8];//hold all the data
int age[300];//hold the age
const int BUFFSIZE = 180;
char buff[BUFFSIZE]; // a buffer to temporarily park the data
int main(int)
{//top of main
ifstream infile;
stringstream ss;
int r=0;
int c=0;
infile.open("c: unners.csv");
if (!infile)
{
cout<<"file did not open and program will terminate"<<endl;
system("PAUSE");
return(1);
}
else
{
cout<<"file opened ok"<<endl;
system("PAUSE");
}
cout<<"start of processing"<<endl;
for(r=0;r<=270;r++)
{//top of for r
infile.getline( buff, BUFFSIZE );
ss << buff;
for(c=0;c<=7;c++)
{ //top of c
ss.getline( buff, 40, ',' );
sarray[r][c]=buff;
}//bottom of c
age[r]=atoi(buff);
ss << "";
ss.clear();
}//end of for r
for(r=0;r<=270;r++)
{
cout<<endl;
for(c=0;c<=7;c++)
{
cout<<sarray[r][c]<<" ";
}
cout<<age[r];
cout<<endl;
}
cout<<endl;
cout<<"end of processing"<<endl;
system("PAUSE");
return(0);
}
1. Average age for all runners
2. Average age for female runners only
3. Count of runners from Alabama
4. Count of female runners from Alabama
5. Count of runners over 40 years-old
6. Count of females over 40 years-old
7. Count of runners in the 50k event
8. Count of females in the 50k event
9. Find jim barnett (his name is in lower case in the data) and print out his age (read one row of the array at a time until lastname is ==
Explanation / Answer
If no one answers please rate me a life saver...please,please....understand.....thank you..!!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.