问题描述:
C 语言 用while loop 停不下来了
Part 1:Reading user input,keeping track of scores.
Write a program that asks one question,records the response,keeps track of a "score," and
prints out the score after a response.This question needs to have a score associated with the
answer chosen.For example,if the answer to the question is one that you like,the score should
reflect that answer.In the example below,if the user enters a 1,the program will add 60 to
their score,if the user enters a 2,then 45 is subtracted from their score.It is up to you to
determine your scoring system.Your program should continue to ask for the answer until the
user enters a valid response.
Here is an example of a question:
Do you like The Big Bang Theory (1-yes,2- no):1
score = 60
Here is an alternate run:
Do you like The Big Bang Theory (1-yes,2- no):2
score = -45
Here is an alternate run:
Do you like The Big Bang Theory (1-yes,2- no):3
INVALID selection.
Do you like The Big Bang Theory (1-yes,2- no):
Part 1:Reading user input,keeping track of scores.
Write a program that asks one question,records the response,keeps track of a "score," and
prints out the score after a response.This question needs to have a score associated with the
answer chosen.For example,if the answer to the question is one that you like,the score should
reflect that answer.In the example below,if the user enters a 1,the program will add 60 to
their score,if the user enters a 2,then 45 is subtracted from their score.It is up to you to
determine your scoring system.Your program should continue to ask for the answer until the
user enters a valid response.
Here is an example of a question:
Do you like The Big Bang Theory (1-yes,2- no):1
score = 60
Here is an alternate run:
Do you like The Big Bang Theory (1-yes,2- no):2
score = -45
Here is an alternate run:
Do you like The Big Bang Theory (1-yes,2- no):3
INVALID selection.
Do you like The Big Bang Theory (1-yes,2- no):
问题解答:
我来补答展开全文阅读