抓老鼠

mac2022-07-05  35

,1,实验代码 include <stdio.h> int main (void) { int unhappy = 0, sad = 0, happy = 0, profit = 0; char c; while ( ( c = getchar() ) != '$' ) { if ( unhappy && !happy ) { printf("-"); --unhappy; } else if ( sad && !happy ) { printf("-"); --sad; } else { if ( happy ) --happy; if ( c == 'T' ) { printf("D"); sad = 2; profit += 7; } else if ( c == 'C' ) { printf("!"); happy = 2; profit -= 3; } else { printf("U"); unhappy = 1; } } } printf("\n%d", profit); return 0; },2,设计思路

3,问题。 这个题目对于我来说,太难了 4,pta截图

转载于:https://www.cnblogs.com/George-/p/10412650.html

相关资源:VC 猫捉老鼠捉迷藏游戏.rar
最新回复(0)