Answer:
variable one stores 10.5 and two stores 30.6
Explanation:
In c++ language, the cout keyword is used to write to the standard output. The input from the user is taken by using the cin keyword.
For the input from the user, a variable need is declared first.
datatype variable_name;
The input can be taken one at a time as shown.
cin >> variable_name;
The input for more than one variable can be taken in a single line as given by the syntax below.
1. First, two variables are declared.
datatype variable_name1, variable_name2;
2. Both input is taken simultaneously as shown.
cin >> variable_name1, variable_name2;
For the given scenario, two double variables are declared as below.
double one, two;
The question mentions input values for the two double variables as 10.5 and 30.6.
3. The given scenario takes both the values as input at the same time, in a single line as shown below.
cin >> one >> two;
4. After this statement, both the values entered by the user are accepted.
The values should be separated by space.
First value is stored in the variable one.
Second value is stored in the variable two.
5. The user enters the values as follows.
10.5 30.6
6. The value 10.5 is stored in variable one.
7. The value 30.6 is stored in variable two.
The c++ program to implement the above is given below.
#include <iostream>
using namespace std;
int main() {
double one, two;
cout << " Enter two decimal values " << endl;
cin >> one >> two;
cout << " The input values are " << endl;
cout << " one : " << one << " \t " << " two : " << two << endl;
return 0;
}
OUTPUT
Enter two decimal values
10.5 30.6
The input values are
one : 10 two : 530.6