logo CodeStepByStep logo


Language/Type: C++ basics console output
Related Links:

Write a complete C++ program with a main function that computes who won the Stanford-Berkeley football game. The program should ask the user for the two scores. You may assume that the user enters valid non-negative integers. Below is an example dialogue (user input is shown like this):

Stanford: How many points did they score? 87
Cal: How many points did they score? 3
Stanford won!

(You don't need to write any 'include' or 'using' statements.)

Note: You must declare your main function with the following header:

int main() {
Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.