Solution: Fix the Errors
The main() function stores a person’s current age, calculates their age for the next year, and prints both values.
Declares an integer variable
agewith the value19to represent the current age.Declares another integer variable
nextYearand assigns itage + 1to calculate the age for the next year.Uses
coutto print "You are 19 years old."Prints another line showing the next year’s age: "Next year you'll be 20"
Ends with
return 0;to indicate successful program completion.
Solution: Fix the Errors
The main() function stores a person’s current age, calculates their age for the next year, and prints both values.
Declares an integer variable
agewith the value19to represent the current age.Declares another integer variable
nextYearand assigns itage + 1to calculate the age for the next year.Uses
coutto print "You are 19 years old."Prints another line showing the next year’s age: "Next year you'll be 20"
Ends with
return 0;to indicate successful program completion.