- This topic has 1 reply, 2 voices, and was last updated 13 years, 8 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Miscellaneous › Others › C++ Programming for Simple Calculator
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
double result,m; // The result of the calculations
char oper_char,C; // The user-specified operator
double value;
// Value specified after the operator
main()
{
result=0;
clrscr (); // Initialize the result
// Loop forever (or until break reached)
while(1)
{
cout<<result;
cin>>oper_char>>value;
if((oper_char==’q’)||(oper_char==’Q’))
break;
clrscr ();
switch(oper_char)
{
case ‘+’:
result+=value;
break;
case ‘-‘:
result-=value;
break;
case ‘*’:
result*=value;
break;
case ‘/’:
if(value==0)
{
cout<<“Error: Divide by zeron”;
cout<<“Operation ignoredn”;
}
else
result/=value;
break;
case ‘C’:
cout<<result;
break;
default:
cout<<“Unknown operator”<<oper_char<<‘n’;
break;
}
}
getch();
return (0);
}
hello everyone!!.. will you all help me.. from above program… how we can put the coding for Memory Store (MS) and Memory Recall (MR) in C++ Calculator above….urgent… thanks all….. I’m using compiler software is Borland C++….
please send circuit diagram of calculator using 8052 microcontroller,