I am brand new to programming,so I apologize in advance.
I was given an assignment to put together a simple program using putty. I was able to do the first part of the assignment below and everything worked fine.
cout << endl;
cout << "Total: $" << total << endl;
cout << endl;
cout << "Thank you! Have a nice day!!" << endl;
return 0;
}
I now need to edit the above program with the program below that was supplied by the instructor so that it reads from the input file.
#include <fstream>
using namespace std;
float book1Price, book2Price;
int main()
{
ifstream inFile; // Input file
inFile.open("input3.dat"); // Open the input file
inFile >> book1Price >> book2Price; // Read 2 data elements from file, delimited by white space
ifstream inFile; // Input File
inFile.open("input3.dat"); // Open the Input
inFile >> book1Price >> book2Price; // Read 2 data elements from file, delimited by white space
Well I would have went elsewhere if I knew I would have just gotten a smart-ass answer. I found that, but that does not explain why I get the error I do, nor does it FIX the error. So thanks for nothing.
I guess the sticky about people being courteous on here is inaccurate. I apologize for making you waste your time to make that absurd URL.
Well I'm glad I could make you giggle over Google.
I figured it out. I guess I was NOT UNDERSTANDING that I need the iostream and fstream in order for it to work properly, but I'm sure you knew that simply by looking at what I initially posted. I was looking for an explanation of why what I had wrong and why I needed one thing versus the other.
I did understand that. You just took the whole "let me Google that for you" too seriously. Have you ever said something stupid? I have many times, and people have mocked me about it for months! Just take it as it is: A simple joke. :-) Say "Ok, it was stupid of me not reading carefully and not experimenting a bit before boldly stating that I googled it already.", and just move on. I agree that saying or doing something stupid doesn't make you stupid. Just avoid repetitions. :D
I know it's a joke, and I can understand the humor in it, completely, especially if I was experienced and knew what I was doing. I did experiment to no avail and searched but could not find something that I actually understood. After a couple of hours (no joke) of tinkering with no idea of what outcome I would get, I resorted to coming here against my better judgement because I know how "newbies" get treated by those who know what they are doing. Up until now I wasn't finding humor in anything. But like you said, it is what it is...life goes on. :)