Joined: Sat Mar 28, 2009 3:10 pm Posts: 1 Has thanked: 0 time Have thanks: 0 time
Well, it's the weekend, and my program due for class tomorrow isn't finished. The instructor isn't likely going to be available, so I'm hoping someone on here might be able to help out with a problem I'm having. I'll give the general layout of the program I am writing:
We are to pull from a text file the following information, in this format:
New York 0.075 0.06 0.081 0.056 0.065 0.068 0.07 0.059 0.07 0.075 0.068 0.073
The location is of course listed at the top in string format, and all of the individual numbers are ppm readings. The first in each row is a standard, the following three in that row are readings from sensors placed throughout the location. My programs purpose is to pull this information from the file, compare the readings to the standard, decide whether or not each polutant is in compliance with set standards.
Let's say this is in a simple notepad text file laid out as such. I forgot to mention, in my instructions at the end of each row there could be uneeded information, so I would need an ignore line for each row I would guess. This is how I have the first part of my program laid out, and just to test to see if the values are actually being pulled, I stuck in a section of COUT that isn't needed in the final program. Here is what I have :
/*For simplicity sake, I am only using the first two rows of variables! These aren't all I will need for the entire program, I am aware of that. Just to show what the problem I'm having is.*/
cout << "TEST to see if values are pulled from file " << ozstd << " " << oz1 << " " << oz2 << " " << oz3 << endl;
return 0; }
When I compile this, everything runs fine, except for one thing. I get this random string of numbers in my output AND, I can type any filename into the prompt, I will get the same set of numbers in output. Lets say the file name is TEST1.txt That's the exact way I type it in, but I could also type TST1.txt and get the same result. I believe it's just not opening and reading from the file. Any ideas at all would be greatly appreciated! Thanks!