i have done this code which can do add, sub, mul, div and square. But this much function is not sufficient for a calculator. I want to add one exponential function and one square root function. plz help me frens
Code:#include <iostream> int main() { double num; double num2; char choice; for (;;){ do { cout<<"\n"; cout<<"Welcome to apex calculator.\n"; cout<<"Please choose an option by entering the number, press q to quit\n"; cout<<"1 - Addition\n"; cout<<"2 - Subtraction\n"; cout<<"3 - Division\n"; cout<<"4 - Multiplication\n"; cout<<"5 - Help\n"; cout<<"6 - About This Program\n"; cout<<"7 - find square\n"; cin>>choice; } while ( choice < '1' || choice > '7' && choice != 'q'); if (choice == 'q') break; switch (choice) { case '1': cout<<"Please enter a number\n"; cin>>num; cout<<"Another number to be added\n"; cin>>num2; cout<<num + num2; cout<<"\n"; break; case '2': cout<<"Please enter a number\n"; cin>>num; cout<<"Another number to be subtracted\n"; cin>>num2; cout<<num - num2; cout<<"\n"; break; case '3': cout<<"Please enter a number\n"; cin>>num; cout<<"Another one to be divided\n"; cin>>num2; cout<<num / num2; cout<<"\n"; break; case '4': cout<<"Please enter a number\n"; cin>>num; cout<<"Another one to be multiplied\n"; cin>>num2; cout<<num * num2; cout<<"\n"; break; case '5': cout<<"This is a simple calculator made by bishal, manoj, pramesh and ram\n"; cout<<"To select an option, type the number next to the option and press enter\n"; cout<<"E.G. for division, you would type 3 and press enter.\n"; cout<<"\n"; break; case '6': cout<<" apex calculator, made by bishal, manoj, pramesh and ram \n"; cout<<"\n"; break; case '7': cout<<"please enter a number\n"; cin>>num; cout<<"the square is \t "<<num*num; cout<<"\n"; break; default: cout<<"That is not an option"; } } return 0; }



LinkBack URL
About LinkBacks



