I'm learning C++ off of this very website, and i'm up to this section :
http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/
im trying to create a very simple calculator and just need 2 things from you guys:
1. As you have "int main" there is "char operation" what is char? character?, and if so, then what characters is it for?
2. What is meant by the error and how do i fix it? "error C2660: 'Calculate' : function does not take 0 arguments"
Here is a copy of my code, and i'm using Microsoft Visual Studio Express 2013 for Windows Desktop. I will reply to any questions ASAP. Thanks
1 #include "stdafx.h"
2 #include <iostream>
3
4 int Getuserinput()
5 {
6 using namespace std;
7 cout << "Get user input: ";
8 int userinput;
9 cin >> userinput;
10 return userinput;
11 }
12
13 char Getuseroperation()
14 {
15 using namespace std;
16 cout << "Please enter a function (+,-,*,/) : ";
17 char operation;
18 cin >> operation;
19 return 0;
20 }
21
22 int Getuserinput2()
23 {
24 using namespace std;
25 cout << "Enter second digit : ";
26 int userinput2;
27 cin >> userinput2;
28 return 0;
29 }
30
31 int Calculate(int userinput,char operation,int userinput2)
32 {
33 if (operation == '+')
34 return userinput + userinput2;
35 if (operation == '-')
36 return userinput - userinput2;
37 if (operation == '/')
38 return userinput / userinput2;
39 if (operation == '*')
40 return userinput * userinput2;
41 return 0;
42 }
43 int main()
44 {
45 //User enetered number
46 Getuserinput();
47 Getuseroperation();
48 Getuserinput2();
49 Calculate();
50 }