Problem C
The Warm Summer
Write a program that doubles any input, until the user does not want anything else doubled.
Input
Input starts with one line containing a string $s$, where if $s$ is Y the following input repeats until $s$ is not Y.
-
A line containing one floating point number $d$, where $-1\, 000\, 000 \leq d \leq 1\, 000\, 000$.
-
A line containing the new value of $s$.
It is guaranteed that each character in the input, except for the newline characters, belongs to the set of printable characters in the ASCII table, and that the numbers are given with at most six digits after the decimal point.
Output
First, the program should prompt the user with “You need something doubled? (Y)es? ”, without quotations. The following repeats until the user does not input Y, at which point the program exits without outputting anything else:
-
The program prompts the user with “All right, then. Give me a number, and I’ll double it for ya: ”, without quotations.
-
The program outputs the value of $d$ doubled.
-
The program prompts the user with “You need something else doubled? (Y)es? ”, without quotations.
The output numbers should have an absolute or relative error of at most $10^{-6}$.
Sample Input 1 | Sample Output 1 |
---|---|
No thanks! |
You need something doubled? (Y)es? |
Sample Input 2 | Sample Output 2 |
---|---|
Yes please! |
You need something doubled? (Y)es? |
Sample Input 3 | Sample Output 3 |
---|---|
Q |
You need something doubled? (Y)es? |
Sample Input 4 | Sample Output 4 |
---|---|
Y 5 Y 16 Y 0 Y 239476 N |
You need something doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 10.000000 You need something else doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 32.000000 You need something else doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 0.000000 You need something else doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 478952.000000 You need something else doubled? (Y)es? |
Sample Input 5 | Sample Output 5 |
---|---|
Y -234 Y -21351 N |
You need something doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: -468.000000 You need something else doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: -42702.000000 You need something else doubled? (Y)es? |
Sample Input 6 | Sample Output 6 |
---|---|
Y 1.0 Y 3.14 Y 2435.093475 Y 325.93284 N |
You need something doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 2.000000 You need something else doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 6.280000 You need something else doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 4870.186950 You need something else doubled? (Y)es? All right, then. Give me a number, and I'll double it for ya: 651.865680 You need something else doubled? (Y)es? |