Tue Apr 30, 2013 2:07 am
#include <iostream>
#include <string>
#include <fstream>
#include<iomanip>
using namespace std;
int date[30];
int size=30;
double pressure[30];
double highTemp[30];
double lowTemp[30];
int windSpeed[30];
int batteryPower[30];
string solarPanelOpen[30];
int k=0;
string month;
{
ifstream inCuriosityRoverFile("CuriosityRover.txt", ios::in );
if(!inCuriosityRoverFile)
{cerr<< "File could not be opened"<<endl;
exit(1);}// exit if statement
cout<<"***************************************************************"<<endl;
cout<<"Curiosity Data Collected"<<endl;
while(getline(inCuriosityRoverFile.seekg(0), month, ','))
{cout<<"\n\nMonth: " << month<<endl;
cout<<"***************************************************************"<<endl;
while(inCuriosityRoverFile >> date[k] >> pressure[k] >> highTemp[k]>>lowTemp[k]>> windSpeed[k]>>batteryPower[k]>>solarPanelOpen[k])
{cout<<setw(2)<<date[k]<<" " <<setw(6)<<pressure[k] <<" " << setw(6)<<highTemp[k] <<" " << setw(5)<<lowTemp[k] <<" "
<< windSpeed[k]<<setw(5)<<" " << batteryPower[k] <<" " << setw(5)<<solarPanelOpen[k] << endl;
++k;
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.