Total members 11895 |It is currently Sat Dec 21, 2024 1:47 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Ok, here goes... How I would access certain elements in the array to perform calculations??? i.e pressure[0]to[7]?????
Code:
#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





Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Reading selected data from a source file
 Encrypt/Decrypt a file from source file to target file.     -  
 Reading the all file in php     -  
 Reading file with integers     -  
 Multithreaded File Reading     -  
 Reading and Writing To text file     -  
 location of a package statement within a source code file     -  
 How to merge the data into file     -  
 Loading table data from a CSV file     -  
 How to make PHP form data saved into txt file     -  
 Reading a File Line by Line in php     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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