int main() {
double a = 1.5;
double b = 2.5;
double c = 3.5;
string x;
cout << "Enter a = " << a; // display the value by default
getline(cin, x); // receive user input
if(!x.empty()){ // check whether input is empty
x >> a;
}
cout << endl;
cout << "Enter b = " << b;
getline(cin, x);
if(!x.empty()){
x >> b;
}
cout << endl;
cout << "Enter c = " << c;
getline(cin, x);
if(!x.empty()){
x >> c;
}
cout << endl;
cout << "sum = " << a + b + c << endl; // display the result
return 0;
}
However, I want these three to display at the same time (now they display one by one), and in the console window I can move the cursor between input place of a, b and c with "arrow key" of keyboard.