Newbie Member
30Mar2010,01:29   #11
kadjam's Avatar
what about a supermarket service to calculate prices of goods with fixed prices. with a cashier log in
Newbie Member
30Mar2010,01:38   #12
kadjam's Avatar
what about a supermarket service to calculate prices of goods with fixed prices. with a cashier log in
Newbie Member
22Jun2010,12:34   #13
saji777's Avatar
tnx but i think we needed a top source from calculator
Specal thanks
Newbie Member
28Jun2010,03:55   #14
newtosee's Avatar
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

Anyway, I would love to read your feedback ^^

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);
double add(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;}
if (z=='+'){cout<<"=" <<add (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!
Newbie Member
5Aug2010,11:27   #15
cute_dhanju's Avatar
gud,....................
Newbie Member
12Aug2010,02:41   #16
atena.sharifi's Avatar
hi ,thanks for program ,but this program in the line 25 give error . error : cannot call 'main' from within the program in function main().
please help me .
sorry for level low language.
Go4Expert Founder
12Aug2010,08:32   #17
shabbir's Avatar
Quote:
Originally Posted by atena.sharifi View Post
hi ,thanks for program ,but this program in the line 25 give error . error : cannot call 'main' from within the program in function main().
please help me .
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
Light Poster
7Sep2010,13:17   #18
matuatua's Avatar
i will try it later,anyway thank u for that code
Newbie Member
13Sep2010,17:03   #19
hemamca's Avatar
hai do i know which editor is best now in c / c++ languages. is better Microsoft or Turbo C
Go4Expert Founder
13Sep2010,17:04   #20
shabbir's Avatar
TC is outdated and not used anymore.