Solution: Favorite Color Message
The main() function stores a person's name and favorite color using string variables, then prints a personalized message.
Declares a string variable
namewith the value"Jordan"to store the person’s name.Declares another string variable
colorwith the value"blue"to store the favorite color.Uses
coutto print both variables together in a sentence:
"Hey Jordan, your favorite color is blue!"Ends with
return 0;to indicate successful program completion.
Solution: Favorite Color Message
The main() function stores a person's name and favorite color using string variables, then prints a personalized message.
Declares a string variable
namewith the value"Jordan"to store the person’s name.Declares another string variable
colorwith the value"blue"to store the favorite color.Uses
coutto print both variables together in a sentence:
"Hey Jordan, your favorite color is blue!"Ends with
return 0;to indicate successful program completion.