0
Newbie Member
what about a supermarket service to calculate prices of goods with fixed prices. with a cashier log in
0
Newbie Member
what about a supermarket service to calculate prices of goods with fixed prices. with a cashier log in
0
Newbie Member
tnx but i think we needed a top source from calculator
Specal thanks
0
Newbie Member
Hy, I begun studying c++ a few days ago and I came across this topic and decided to write a similar program in c++...

The code was a bit inspired from the original c calculator

Code:
```#include <cstdlib>
#include <cstdio>
#include <iostream>

using namespace std;

double x;
double y;
double multi(double x, double y);
double divi(double x, double y);
double sub (double x, double y);

int main(int argc, char *argv[])
{
char a, z;
for(;;)
{
cin>> x; cin>> z; cin>>y;
if (z=='*'){cout<<"=" <<multi (x,y)<< endl;}
if (z=='/'){cout<<"=" <<divi (x,y)<< endl;}
if (z=='-'){cout<<"=" <<sub (x,y)<< endl;}

cout<<"Would you like to do another operation? [y/n]";
cin>>a;
if
(a!='y')
{break;}
}
system("PAUSE");
return EXIT_SUCCESS;
}
double multi (double x, double y)
{return x*y;}
double divi (double x, double y)
{return x/y;}
double sub (double x, double y)
{return x-y;}
double add (double x, double y)
{return x+y;}```
Cheers!
0
Newbie Member
gud,....................
0
Newbie Member
hi ,thanks for program ,but this program in the line 25 give error . error : cannot call 'main' from within the program in function main().
sorry for level low language.
0
Go4Expert Founder
Quote:
Originally Posted by atena.sharifi
hi ,thanks for program ,but this program in the line 25 give error . error : cannot call 'main' from within the program in function main().
sorry for level low language.
You are using a Cpp compiler and try a C compiler and it would work. For some old TC compiler just renaming the file to .c would compile it for you
0
Go4Expert Member
i will try it later,anyway thank u for that code
0
Newbie Member
hai do i know which editor is best now in c / c++ languages. is better Microsoft or Turbo C
0
Go4Expert Founder
TC is outdated and not used anymore.