I am developing some basic exercises and I get stuck in this, the program asks me to make a result of a variable x1 and that is equal to nX but if it is 1 that only shows x. Example
a = 1 * x a = x
#include<iostream>
using namespace std;
int main () {
int x1,a;
char X;
cout<< "ENTERO POR CHAR";
cout<< "DIGITE EL VALOR DE X1: "; cin >> x1;
a = x1 * X;
cout << a;
//Si se digita un 1 en x1 que salga en pantalla una x.
//Si se digita un 2 en x1 que salga en pantalla un 2x.
return 0;
}
I had thought about it with:
cout<< a << "x";
But if a is 1 it would not print x if 1x.