Ok, so this is going to be a basic question that I should probably know, but it's baffling me right now... Also, be prewarned that this is a homework assignment I'm working on. I don't want answers, just guidance. I understand what I need top do(for the most part. obviously there's something I don't understand else I wouldn't be here.. ANYWAYS:
I have said code below:
#include <iostream>
#include <iomanip.h>
#include <fstream.h>
#include <cstdlib>
using std::cout;
using std::ios;
using std::endl;
int main()
{
int day;
char temp [5];
char marker [5];
int counter1 = 0;
int counter2 = 1;
ifstream output;
output.open("TEMPS.DAT", ios::in);
if(output)
{
while(!output.eof())
{
cout << "Day " << marker[counter2] << ":\n";
output << temp[counter1] << endl;
//output.ignore(80,'\n');
//temp = atoi(day[counter1]);
cout << temp[counter1] << '\n';
counter1++;
counter2++;
}
}
else
{
cout << "ERROR. TERMINATING PROCESS.\n";
}
output.close();
return 0;
}
inside TEMPS.DAT is the following:
65
42
31
24
all I want to do right now is to put each of the temperatures inside this file into a variable and print it out to the screen. I think that I have a problem with the way I've done my character arrays, and I'm looking into that, but right now, the only two errors I'm getting are:
h:\__Online Course Work\Chapter 11\Book Projects\HIGHTEMP2.CPP||In function 'int main()':|
h:\__Online Course Work\Chapter 11\Book Projects\HIGHTEMP2.CPP|33|error: no match for 'operator<<' in 'output << temp[counter1]'|
||=== Build finished: 1 errors, 0 warnings ===|
I've done some stuff with file output before... stuff more complicated than this, so the fact that I can't figure this out is kind of degrading for me >_<
If someone can point me in the right direction, that would be very helpful. :)