My calculator doesnt run!

There´s an error in line 70 that i can´t find. I think that everything is alright.

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//Calculator by Enrique Junchaya
#include <iostream>

using namespace std;

double addition(double x, double y)
{
	return x+y;
}

double substraction(double x, double y)
{
	return x-y;
}

double multiplication(double x, double y)
{
	return x*y;
}

double division(double x, double y)
{
	return x/y;
}

long long factorial(int x)
{
	int n;
	long long m=1;
	for ( n=x ; n>0 ; --n )
	{
	 	m *= n;
	}
	return m;
}

long long raising(int x, int y)
{
	long long m=1;
	for ( y ; y>0 ; --y )
	{
		m *= x;
	}
	return m;
}

int main()
{
	char o;
	
	double a, b;
	int c, d;
	label:
	cout << "What operation do you want to do?" << endl;
	cout << "Write +, -, *, /, ! or ^." << endl;
	cin >> o;
	switch(o)
	{
		case '+':
			cout << "Now write the numbers." <<endl;
			cin >> a;
			cin >> b;
			cout << a << "+" << b << " = " << addition(a,b);
			goto label;

		case '-':
			cout << "Now write the numbers." << endl;
			cin >> a;
			cin >> b;
			cout << a << "-" << b < " = " << substraction(a,b) << endl;
			goto label;

		case '*':
			cout << "Now write the numbers." << endl;
			cin >> a;
			cin >> b;
			cout << a << "*" << b << " = " << multiplication(a,b) << endl;
			goto label;

		case '/' :
			cout << "Now write the numbers." << endl;
			cin >> a;
			cin >> b;
			cout << a << "/" << b << " = " << division(a,b) << endl;
			goto label;
			
		case '!':
			cout << "Now write the entire number." << endl;
			cin >> c;
			cout << c << "! = " << factorial(c) << endl;
			goto label;
			
		case '^': 
			cout << "Now write the entire number to be raised. ";
			cin >> c;
			cout << "Now write the exponent. ";
			cin >> d;
			cout << c << "^" << d << " = " << raising(c,d) << endl;
			goto label;			
			
		default:
			cout << "Unknown Character. Try again." << endl;
			goto label;
	}
}
cout << a << "-" << b << " = " << substraction(a,b) << endl;

You forgot one of the right-angle brackets.
Last edited on
LOL How couldn´t I see it .-.!
Topic archived. No new replies allowed.