error

what did i do wrong

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 #include <iostream>
#include "conio.h"
#include <string>
using namespace std;
 
int Addition(int x, int y);
int Subtraction(int x, int y);
int Multiplication(int x, int y);

void main(){
	int num1;
	int num2;
	string mathType;
	cout << "what do you want to do? add, subtract, or multiply" << endl;
	getline (cin, mathtype);
	cin.clear();
	cout << "you picked" << mathType << endl;
	cout << "Enter first number";
	cin >> num1;
	cout << "Enter second number";
	cin >> num2;
	if(mathtype == "add")
		{Addition(num1, num2)
		cout <<"the number added equal << Addition(num1, num2) << endl;}
	_getch();
}

int Addition(int x, int y){
	int numAnswer;
	numAnswer = x + y;
	return numAnswer;
}
int Subtraction(int x, int y){
	int numAnswer;
	numAnswer = x - y;
	return numAnswer;
}
int Multiplication(int x, int y){
	int numAnswer;
	numAnswer = x * y;
	return numAnswer;
	} 
As the syntax highlighting shows pretty clearly, you are missing your closing quote on line 24.

Also, it should be int main(), not void main().
mind also your casing. mathtype/mathType
Line 15 the t in mathtype should be uppercase.
Line 22 the t in mathtype should be uppercase
line 23 missing ;
line 24 missing "
Last edited on
Topic archived. No new replies allowed.