標籤:

C 語言筆記 day04

switch 語句

#include <stdio.h>int main(int argc, const char * argv[]) { int num; printf("輸入一個1-7之間的數字:"); scanf("%d",&num); switch (num){ case 1: printf("一隻單身狗
"); break; case 2: printf("秀恩愛死得快
"); break; case 3: printf("搞3P
"); break; case 4: printf("我發誓,我再也不敢了
"); break; case 5: printf("555~我要買6s
"); break; case 6: printf("66666
"); break; case 7: printf("你個J巴
"); break; default: printf("你輸個毛啊
"); break; } }

while 語句

#include <stdio.h>int main(int argc, const char * argv[]) { int count = 100; while (count > 0) { count--; printf("打手槍??,剩餘子彈%d只
", count); }}

break、continue關鍵字,do-while、for語句

概念很淺顯易懂,只需要知道代碼如何寫就??了。

day04,卒。

推薦閱讀:

TAG:C語言入門 | iOS |