(I AM A NOOB) Multiplication problems

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//A simple calculator only capable of multiplication.

#include<iostream>
using namespace std;

int main()
{
int num1, num2

cout << "Please enter a number: \n" << endl;
cin >> num1;
cout << "Please enter another number: \n" << endl;
cin >> num2;

cout << "Here is your result: " << num1 *num2 << endl;

return 0;
}


This is my simple multiplication calculator code. I originally has a few errors, but they were fixed, however, I am left with two problems.

Line 10: error:expected initializer before 'cout'
Line 13: error:'num2' was not declared in this scope.

What have I done wrong? I can not see it... Thanks.
You forgot to place a semicolon in the end of the statement

int num1, num2


vlad is right. And for the other part,

 
int num1, num2


Make this
1
2
int num1;
int num2;


and instead of

 
cout << "Here is your result: " << num1 *num2 << endl;


do

 
cout << "Here is your result: " << num1 * num2 << endl;
Topic archived. No new replies allowed.