Multiple file line reading program (part 3).

Words
19
Reading
1 min
Listen
Play
9y

Program body

#include iostream
#include string
#include fstream
using namespace std;

int main (){
ifstream file;
file.open("izuna.txt");
if(!file.is_open()){
cout<<"unable to load the file please check the directory"<<endl;
}else {
cout<<"File opened successfully!"<<endl;
string lines;
while(file.good()){
getline(file,lines);
cout<<lines<<endl;
}
}
return 0;
}

Working of program

this is multiple lines reading program of C++ in codeblocks!
x11.jpg
When you have the text file in that directory than this program will be executed else its gonna give, "unable to load the file please check the directory".

I hope you enjoyed and will learn more in future from learnandgrow@learnandgrow