For Loop to Read From File C++
while loop and read file program
i take to write a plan that 2. Apply file I/O to read the integers from the file. If the data file is saved in your project binder, only
the file name is needed when you lot declare an ifstream variable, otherwise, a path to the file is
required.
3. Suppose the ifstream variable is input, and so apply while(!input.eof()) for testing whether the cease
of file is reached.
This is all I accept so far... Delight help!
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inFile;
inFile.open (" hw4dataf11.txt")
y=ten%2
if (y=0) = even;
if (y=one) = odd;
}
http://www.cplusplus.com/medico/tutorial/files/
Taken from the to a higher place link...
| |
EDIT:
Woo my 100th post :D
Last edited on
In that location are so many things wrong nearly this information technology hurts a little.
@xander337 be squeamish, he is just starting :P
Here is a complete program that will take each line (if it is a number) and output "Odd" or "Even"
| |
it might be a petty shotty.. whipped it upwardly in a couple minutes
Last edited on
No I mean. Well for ane he posted his thread in the wrong forum. He didn't and then much ask a question as plead for help, oh and he didn't even thinly vale the fact that this is a homework assignment that you just gave him a consummate answer to. Also no lawmaking tags (only that's nitpicking.)
I didn't hateful there was and then much wrong with his code, I meant there was then much wrong with this thread.
Quote "xander337"
oh and he didn't even thinly vale the fact that this is a homework assignment that you just gave him a complete answer to
I didn't think of that... I learn c++ on my own so my first thoughts are that it is a personal projection... >_>
Last edited on
Topic archived. No new replies allowed.
Source: https://www.cplusplus.com/forum/lounge/52458/
0 Response to "For Loop to Read From File C++"
Post a Comment