Monday, May 10, 2021

simple program using file handling (OOP) (89)

 #include<iostream>

#include<fstream>

using namespace std;

int main()

{

string line;

ofstream ob1;

double income;

ob1.open("income.txt");

ob1<<income<<endl;

ob1.close();

ifstream ob2;

ob2.open("income.txt");

if(!ob2)

{

cout<<"file has not be found:"<<endl;

}

while(getline(ob2,line))

{

cout<<"your income is:"<<line<<endl;

}

ob2.close();

ofstream ob3;

ob3.open("Tax.txt");

int tax;

tax=income*13/100;

ob3<<"total Tax will be of this income is:"<<tax<<endl;

ob3.close();

}

No comments:

Post a Comment