Multiple file line reading program (part 3).
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!
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".
great post!
nice post upvoted and reesteeemed thanks