Hello.
I am a beginner programmer and I am writing out a simple program, for a start. But the compiler (codeblocks) showed an error and so I am here to ask for help =)
Here's the code -
Code:
#include <iostream>
using namespace std;
int mult ( int a, int b );
int main()
{
int x;
int *p;
int a;
int b;
p = &x;
cout << "Please input a number: ";
cin >> x;
cin.ignore();
cout << "\nYou have entered " << *p;
cin.get();
cout << "\nPlease enter two numbers to be added up: ";
cin >> a >> b;
cin.ignore();
cout << "\nThe result is - " << mult ( a, b );
cin.get();
}
int mult ( int a, int b )
{
return a + b;
}
void Add()
{
cout <<"\n Add 100";
}
void Subtract()
{
cout <<"Subtract by 50";
}
void Multiply()
{
cout <<"Multiply by 100";
}
void Divide()
{
cout <<"Divide by 10";
}
int input;
cout<<"1. Add\n";
cout<<"2. Subtract\n";
cout<<"3. Multiply\n";
cout<<"4. Divide\n";
cin>> input;
switch (input) {
case 1:
Add();
break;
case 2:
Subtract();
break
case 3:
Multiply();
break
case 4:
Divide();
break
default:
cout<<"Input not recognized. Quitting now\n";
break;
}
cin.get();
}
And here's the error -
Line 53, 54 and 55
expected constructor, destructor or type conversion before << token
I need help to fix this error. Perhaps anyone has the freetime to teach me a thing or two?
Reply ASAP please