jis tara ye culcolater ki coding hy is ko kis format may save karna hh
#include <iostream>
using namespace std;
int main()
{
double num;
double num2;
char choice;
for (;
{
do {
cout << "Calculator\n";
cout << "Choose one of the following options:\n";
cout << "1 - Addition\n";
cout << "2 - Subtraction\n";
cout << "3 - Multiplication\n";
cout << "4 - Division\n";
cin>>choice;
} while (choice < '1' || choice > '7' && choice != 'q');
if (choice == 'q') break;
switch (choice){
case '1':
cout << "Choose number\n";
cin>>num;
cout << "Other number to add\n";
cin>>num2;
cout<< "Result is " << num+num2;
cout<<"\n";
cout<<"\n";
cout<<"\n";
break;
case '2':
cout << "Choose number\n";
cin>>num;
cout << "Other number to substract\n";
cin>>num2;
cout<<"Result is " << num-num2;
cout<<"\n";
cout<<"\n";
cout<<"\n";
break;
case '3':
cout << "Choose number\n";
cin>>num;
cout << "Other number to multiply\n";
cin>>num2;
cout<<"Result is " << num*num2;
cout<<"\n";
cout<<"\n";
cout<<"\n";
break;
case '4':
cout << "Choose number\n";
cin>>num;
cout << "Other number to devise\n";
cin>>num2;
cout<<"Result is " << num/num2;
cout<<"\n";
cout<<"\n";
cout<<"\n";
break;
default:
cout<<"Choose other option\n";
}
}
return 0;
}
Bookmarks