compile , run and learn!! Its very simple and easy to understand
#include<iostream>
using namespace std;
void cal()
{
char opt='+';
float a,b;
float tot;
cout<<" ";//space
cin>>a;
cout<<endl;
cout<<" ";
cin>>opt;
cout<<endl;
tot=a;
while(opt!='=')
{
cout<<" ";
cin>>b;
cout<<endl;
if (opt=='+')
{
tot=tot+b;
}
else if (opt=='-')
{
tot=tot-b;
}
else if (opt=='*')
{
tot=tot*b;
}
else if (opt=='/')
{
tot=tot/b;
}
else
{
cout<<" ";
cout<<" :::::::::Invalid Operation | you can do Only One operation at onece!:::::::::::" <<endl;
}
cout<<" ------------------"<<endl;
cout<<" ";
cout<<tot<<endl;
cout<<" ";
cin>>opt;
cout<<endl;
}
cout<<" ";
cout<<"--------------------"<<endl;
cout<<" "<<"TOTAL = "<<tot<<endl;
cout<<" ============================================================"<<endl;
cout<<" "<<"C++ calculator www.elakiri.com"<<endl<<" "<<endl;
}
void intro()
{
cout<<" ============================================================"<<endl;
cout<<" ";
cout<<"To get final total and to exit press = "<<endl<<" "<<"Use basic mathematical operators (+,-,*,/)"<<endl<<endl<<endl;
cout<<" ============================================================"<<endl;
}
int main()
{
cout<<" ";
cout<<"::::::::::::::::://C++ CALCULATOR VER 0.01\\:::::::::::::::::"<<endl;
intro();
cal();
return 0;
system("pause");
}