?#include<stdio.h>
int main() {
?? ?int i, j;
?? ?for (i = 1;i <= 5;i++) {
?? ??? ?for (j = 1;j <= 20-i;j++) {
?? ??? ??? ?printf(" ");
?? ??? ?}
?? ??? ?for (j = 1;j <= 2 * i - 1;j++) {
?? ??? ??? ?printf("*");
?? ??? ?}
?? ??? ?printf("\n");
?? ?}
?? ?return 0;
}

?
?
?
#include<stdio.h>
#include<stdlib.h>
int main() {
int m, n, count = 0;
m = rand() % (80 - 10 + 1) + 10;
printf("请输入一个10-80之间的整数:");
while (1) {
scanf_s("%d", &n);
count++;
if (m == n) {
printf("恭喜!你猜对了,你真棒!\n");
break;
}
else if (m > n && count < 5) {
printf("对不起,你猜小了,再来一次!");
}
else if (m < n && count < 5) {
printf("对不起,你猜大了,再来一次!");
}
if (count == 5) {
printf("对不起,你没有机会了!\n这个数是:%d游戏结束!\n", m);
break;
}
}
return 0;
}

?
?
?
?
?
?
|