标签:
#include <stdio.h> void main() { int i=0; if(i==0) goto end; for(i=0; i<10; i++) printf("%d ", i); end: printf("the end\n"); }
示例代码:你猜我猜
#include <stdio.h> #include <stdlib.h> int main(int argc, const char * argv[]) { //1.定义变量存储用户输入 int i = 0, age; //2.设置三次循环 while (i < 3) { i++; printf("第%i次猜年龄\n", i); scanf("%i", &age); //3.1产生一个0~25之间的随机数 int computer = arc4random_uniform(25); if (age < computer) { printf("猜小了,再猜一次\n"); }else if(age > computer){ printf("我有那么老吗?\n"); }else if (age == computer) { printf("猜对了,咱们约会吧!\n"); //3.2猜对了直接跳转 // goto out; return 0; } } //4.如果三次都猜错,输出下一行 printf("真是笨,三次都没猜对!\n"); // out: return 0; }
#include <time.h> int main(int argc, const char * argv[]) { //获取当前系统时间 time_t timer; struct tm *p; timer = time(NULL); p = localtime(&timer); printf("当前时间是: %s \n",asctime(p)); return 0; }
标签:
原文地址:http://www.cnblogs.com/wm-0818/p/5062039.html