Question: im fairly new to programming in c++ im trying to get a program that will ask the user their favorite color, favorite integer number and

im fairly new to programming in c++ im trying to get a program that will ask the user their favorite color, favorite integer number and favorite floating point number. It will then display lines of output based on the users responses to these questions. In particular, each line will contain 3 pieces of information The number of lines will be controlled by the favorite integer number. If the favorite integer number is 0 or less, then no lines will be displayed. like thisim fairly new to programming in c++ im trying to get ai know i need to use a for loop but im just not quite sure how to properly use one. here is the code i have and everything works i just want to know how a for loop would work in the the askquestions3 functions.program that will ask the user their favorite color, favorite integer number

$ ./questions_3 What is your favorite color? Teal What is your favorite integer? 6 What is your favorite number? 3.14 1 Teal 3.14 2 Teal 3.14 3 Teal 3.14 4 Teal 3.14 5 Teal 3.14 6 Teal 3.14 1 6 nclude "image_menu.h" #include std::string getString(std::istream& is, std::ostream& os, const std::string& prompt) { std::string str; os > str; return str; } int getInteger(std::istream& is, std::ostream& os, const std::string& prompt) { int num; std::string str; os > str; stoi(str); return num; 10 Nm in N000 Nm 1000 14 15 num = 19 20 21 22 23 24 25 26 27 28 29 30 } double getDouble(std::istream& is, std::ostream& os, const std::string& prompt) { double num; std::string str; os > str; num = stof(str); return num; } int askQuestions3(std::istream& is, std::ostream& os) { std::string str; int num1; double num2; std::string prompt "What is your favourite color? "; str = getString(is, os, prompt); os

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!