// Calculator.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <cstdlib>
using namespace std;
int GetNumber1();
void GetMathematicalOperation();
int GetNumber2();
int CalculateResult();
int PrintResult();
int main()
{
GetNumber1();
GetMathematicalOperation();
GetNumber2();
CalculateResult();
PrintResult();
int CalculateResult( int x, char chOperation, int y);
int PrintResult( CalculateResult( int x, char chOperation, int y));
}
int GetNumber1()
{
cout << "Enter first number: ";
int x;
cin >> x;
return x;
}
char GetMathematicalOperation();
{
cout << "Enter operator: ";
char chOperation;
cin >> chOperation;
return chOperation;
}
int GetNumber2();
{
cout << "Enter second number: ";
int y;
cin >> y;
return y;
}
ERROR in compiler:
1>------ Build started: Project: Calculator, Configuration: Debug Win32 ------
1>Compiling...
1>Calculator.cpp
1>d:\c++projects\calculator\calculator\calculator.cpp(23) : error C2144: syntax error : 'int' should be preceded by ')'
1>d:\c++projects\calculator\calculator\calculator.cpp(23) : error C2660: 'CalculateResult' : function does not take 0 arguments
1>d:\c++projects\calculator\calculator\calculator.cpp(23) : error C2059: syntax error : ')'
1>d:\c++projects\calculator\calculator\calculator.cpp(34) : error C2556: 'char GetMathematicalOperation(void)' : overloaded function differs only by return type from 'void GetMathematicalOperation(void)'
1> d:\c++projects\calculator\calculator\calculator.cpp(9) : see declaration of 'GetMathematicalOperation'
1>d:\c++projects\calculator\calculator\calculator.cpp(34) : error C2371: 'GetMathematicalOperation' : redefinition; different basic types
1> d:\c++projects\calculator\calculator\calculator.cpp(9) : see declaration of 'GetMathematicalOperation'
1>d:\c++projects\calculator\calculator\calculator.cpp(35) : error C2447: '{' : missing function header (old-style formal list?)
1>d:\c++projects\calculator\calculator\calculator.cpp(43) : error C2447: '{' : missing function header (old-style formal list?)
1>Build log was saved at "file://d:\c++projects\Calculator\Calculator\Debug\BuildLog.htm"
1>Calculator - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks!