#include <iostream>
#include <fstream>
using namespace std;

int main(void) {
        ofstream fp;
        fp.open("example.txt");
        
        if (fp.is_open()) {
             fp << "this is first line" <<endl;
             fp << "this is second line" <<endl;
             fp.close();
        }else { 
             cerr<< "error opening file"<< endl;
           }  
       
return 0;
}
