Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space. Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy (2) Extend to also output in reverse. Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 (3) Extend to cast the double to an integer, and output that integer. Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 3.77 cast to an integer is 3 #include #include // Supports use of "string" data type using namespace std; int main() { int userInt; double userDouble; // FIXME: Define char and string variables cout << "Enter integer:" << endl; cin >> userInt; // FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space // FIXME (2): Output the four values in reverse // FIXME (3): Cast the double to an integer, and output that integer return 0; } Write in C++ Please. Thank You.
Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space.
Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy
(2) Extend to also output in reverse.
Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99
(3) Extend to cast the double to an integer, and output that integer.
Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 3.77 cast to an integer is 3
#include <iostream>
#include <string> // Supports use of "string" data type
using namespace std;
int main() {
int userInt;
double userDouble;
// FIXME: Define char and string variables
cout << "Enter integer:" << endl;
cin >> userInt;
// FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space
// FIXME (2): Output the four values in reverse
// FIXME (3): Cast the double to an integer, and output that integer
return 0;
}
Write in C++ Please. Thank You.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images