moevm / oop

Object-oriented programming course
30 stars 225 forks source link

File handling in c++ #874

Open Sana-Afzal123 opened 2 months ago

Sana-Afzal123 commented 2 months ago

File handling in c++

Sana-Afzal123 commented 2 months ago

include

include

using namespace std; int main(){ ofstream outputFile("text.txt"); if (outputFile.is_open()){ outputFile<<"C++ is a high level language\n"; outputFile <<"first released in 1985\n"; outputFile <<"current C++ is objects oriented programming\n"; outputFile <<"it is also implement in compiled language\n"; outputFile <<"many vendor provide C++ programing\n";

outputFile .close(); cout<<"text is present in file\n";} else { cout<<"failed to create the file\n";} return 0; }