So, Im new to programming and just read some of the tutorials. I started programming, thought I should make an easy calculator. Here it is.
#include <iostream>
using namespace std;
int main(){
int a;
int b;
int c;
int d;
cout << "In what way would you like your calculator to count in?\n";
cout << "1) Addition\n";
cout << "2) Subtraction\n";
cout << "3) Multiplication\n";
cout << "4) Division\n";
cout << "Enter a choice: ";
cin >> a;
switch (a){
case 1:
cout << "Enter a number: ";
cin >> b;
cout << "Enter a second number: ";
cin >> c;
d = b+c
cout << "The sum is " << d << "\n";
break;
case 2:
cout << "Enter a number: ";
cin >> b;
cout << "Enter a second number: ";
cin >> c;
if (b > c){
d = b-c
cout << "The sum is " << d << "\n";
break;
} else if(b == c){
cout << "Well, thats 0...";
break;
} else {
cout << "That wont work!";
break;
case 3:
cout << "Enter a number: ";
cin >> b;
cout << "Enter a second number: ";
cin >> c;
d = b*c
cout << "The sum is " << d << "\n";
break;
case 4:
cout << "Enter a number: ";
cin b;
cout << "Enter a second number: ";
cin c;
d = b/c
cout << "The sum is " << d << "\n";
break;
default:
cout << "Not a valid entry...";
break;
}
} |
Very simple, yes. So, when I tried to compile it it came some errors, most very clear. I cleared them all but one.
"In function `int main()':
expected `}' at end of input
[Build Error] [Objects/MingW/Calculator.o] Error 1"
Input? I thought they meant the function at first, cant be that one, as I already have on there. I dont have an input, atleast not one that should be followed with }.
Am I wrong? Correct me, help me! Also, Im using wxDev-C++, if you think the compiler is the problem.