#include<stdio.h>
int main()
{
int input = 0;
printf("你要好好學習嗎(1/0)\n");
scanf("%d", &input);
if (input == 1)
{
printf("好offer\n");
}
else
{
printf("賣紅薯\n");
}
return 0;
}
輸出結果:
#include<stdio.h>
int main()
{
int line = 0;
printf("好好學習\n");
while (line < 20)
{
printf("我敲程式碼:%d行\n", line);
line++;
}
if (line >= 20)
{
printf("好offer\n");
}
return 0;
}
輸出結果:
#include<stdio.h>
int main()
{
int cp = 0;
//彩票
int dn = 0;
//大牛
while (cp == 0&&dn == 0)
{
printf("買彩票\n");
//判斷是否中彩票
printf("是否中彩票(1/0)\n");
scanf("%d", &cp);
if (cp == 1)
{
break;
}
else
{
printf("老實學習\n");
//判斷是否成爲大牛
printf("是否成爲大牛(1/0)\n");
scanf("%d", &dn);
if (dn == 1)
{
break;
}
}
}
if (cp == 1 || dn == 1)
{
printf("贏取白富美\n");
}
return 0;
}
輸出結果: