Calculator

Hi all!
I want to make a calculator that calculates the product between two numbers, but I can't solve it. This is the way I would like to make it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <conio.h>
using namespace std;
int main(){
	int p=1, n1, n2;
	char c;
	cout<<"Type the first number and after, the operator: ";
	cin>>n1;
	putch(c=getch());
        cout<<""<<endl;
	cout<<"Type the second one: ";
	cin>>n2;
	if(c=='x') {
		p=n1*n2;
		cout<<"The product is: "<<p<<".";
	}
        else cout<<"Error";
	return 0;
	
}

P.S. Please do not help me with other code, I just want this programe to work the way I thaught to make it work.
P.P.S. I'm novice.
Last edited on
Sorry, just figured it out!
Topic archived. No new replies allowed.