You are on page 1of 2

#include <iostream>

#include <fstream>
#include <cmath>
#include <string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
cout<<endl;
cout << " *******WELCOME TO SIMPLE CALCULATOR BY
(RTX)*********" << endl<<endl;
for(int i=1;i>0;i++)
{
int n;
cout << "Please enter 1 for slection of Operations:" << endl;
cin >> n;
if (n == 1)
{
int o;
cout << "Enter 1 for Addition:" << endl;
cout << "Enter 2 for substraction:" << endl;
cout << "Enter 3 for Multiplication:" << endl;
cout << "Enter 4 for Division:" << endl;
cout << "Enter 5 for Reminder:" << endl;
cin >> o;
switch (o)
{
case (1):
{
float x, y, z;
cout << "please enter 1st value:" << endl;
cin >> x;
cout << "please enter 2nd value:" << endl;
cin >> y;
z = x + y;
ofstream outdata1("Sum History.txt");
cout << "The Addition of this two number is: " << z << endl;
outdata1 << "The Addition of this two number is: " << z << endl;
break;
}
case(2):
{
float x1, y1, z1;
cout << "please enter 1st value:" << endl;
cin >> x1;
cout << "please enter 2nd value:" << endl;
cin >> y1;
z1 = x1 - y1;
ofstream outdata2("Diff History.txt");
cout << "The Substraction of this two number is: " << z1 << endl;
outdata2 << "The Substraction of this two number is: " << z1 << endl;
break;
}
}

}
else
{
cout << "Wrong entry, please enter again" << endl;
}
int n1;
cout<<"enter 1 for next operation:"<<endl;
cout<<"enter 2 for exit:"<<endl;
cin>>n1;
if(n1==1)
{
continue;
}
else
break;
}

return 0;
}

You might also like