I am taking a course on C++ game dev and one of the exercises asks me to write a program that:
asks the user to input two numbers.
compute those numbers, +, -, *, %.
and then display the results.
It took me forever and a minute, but I got it. But how do I get the command window to display the number the user inputs instead of the n1 and n2?
(i.e: 8 + 4 = 12, not n1 + n2 = 12)
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n1;
int n2;
cout << "please enter a number: ";
cin >> n1;
cout << "please enter another number: ";
cin >> n2;
cout << "n1+ n2 = "<< n1+n2 <<endl;
cout << "n1 - n2 = " << n1-n2 <<endl;
cout << "n1 * n2 = " << n1*n2 <<endl;
cout << "n1 % n2 = " << n1%n2 <<endl;
}