My Code is listed below.
I Used MS Visual C as my compiler.
#include <iostream>
using namespace std;
int main() {
int num{};
cout << "Enter a number: ";
cin >> num;
num = num * 2;
cout << "Double the number you input is: " << num << endl;
return 0;
}
CodePudding user response:
This will loop forever until you hit control-c:
#include <iostream>
using namespace std;
int main() {
while( true ) {
int num{};
cout << "Enter a number: ";
cin >> num;
num = num * 2;
cout << "Double the number you input is: " << num << endl;
}
return 0;
}