Answer to Question #273287 in C++ for mannya

Question #273287

3. Read strings from standard input and wite to a file, read the info from the file and print to console.


1
Expert's answer
2021-11-30T18:19:25-0500
#include <iostream>
#include <fstream>


using namespace std;


int main()
{
    fstream my_file;
    my_file.open("my_file.txt",ios::in);
    if(!my_file){
        cout<<"No such file";
    }
    else{
            char ch;
    while(1){
        my_file>>ch;
        if(my_file.eof())
            break;
        cout<<ch;
    }
        my_file.close();
    }


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS