Solution: Personal Profile
The main() function declares variables of different data types (char, int, and double) and prints a formatted introduction message.
Declares a character variable
nwith the value'A'to represent an initial.Declares an integer variable
agewith the value19to store the age.Declares a double variable
heightwith the value1.74to store height in meters.Uses
coutto print all three variables together in a single sentence:
"Hi, I am Mr. A, I'm 19 years old and 1.74 meters tall!"Ends with
return 0;to signal successful program completion.
Solution: Personal Profile
The main() function declares variables of different data types (char, int, and double) and prints a formatted introduction message.
Declares a character variable
nwith the value'A'to represent an initial.Declares an integer variable
agewith the value19to store the age.Declares a double variable
heightwith the value1.74to store height in meters.Uses
coutto print all three variables together in a single sentence:
"Hi, I am Mr. A, I'm 19 years old and 1.74 meters tall!"Ends with
return 0;to signal successful program completion.