摘要: int main(void){ char ch; char str[80];   printf("Input a string: ");    //先输入字符串 gets(str);//get()   put()   这两个函数并列使用,前者就是从案件获取按键值,  后者是显示输出 puts(str 阅读全文
posted @ 2016-03-15 09:42 ocean2015 阅读(223) 评论(0) 推荐(0)
摘要: main(){ FILE *fp; char str[100],filename[10]; int i=0;if((fp=fopen("test","w"))==NULL) //{printf("cnnot open file\n");exit(0); }printf("lease input a 阅读全文
posted @ 2016-03-14 16:33 ocean2015 阅读(329) 评论(0) 推荐(0)
摘要: //计算机器运行时间 long i = 10000000L;clock_t start, finish;double duration;//测量一个事件持续的时间printf( "Time to do %ld empty loops is ", i) ;start = clock();while( 阅读全文
posted @ 2016-03-12 11:54 ocean2015 阅读(206) 评论(0) 推荐(0)
摘要: char c; clock_t start,end; time_t a,b; double var; int i,guess; srand(time(NULL));loop: printf("DO YOU WANT TO PLAY IT .('y' or 'n')\n"); while((c=get 阅读全文
posted @ 2016-03-12 11:53 ocean2015 阅读(313) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> main() { unsigned int seed; /*申明初始化器的种子,注意是unsigned int 型的*/int k;printf("Enter a positive integer seed value: 阅读全文
posted @ 2016-03-11 16:18 ocean2015 阅读(250) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<malloc.h>#include<conio.h>#include<stdlib.h>#include "math.h"#include"time.h"#define NULL 0 main() { float a;srand(123456); 阅读全文
posted @ 2016-03-11 16:13 ocean2015 阅读(143) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<malloc.h>#include<conio.h>#include<stdlib.h>#include "math.h"#define NULL 0#define LEN sizeof(struct cle) struct cle { int n 阅读全文
posted @ 2016-03-11 10:36 ocean2015 阅读(258) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <malloc.h>#include<graphics.h>#include<conio.h> #define LEN sizeof(struct student)#include "math.h"#define PI 3.1415926 vo 阅读全文
posted @ 2016-02-27 16:29 ocean2015 阅读(368) 评论(0) 推荐(0)
摘要: 举一个简单的例子,如果有按键,就输出相关按键。否则,输出“.”。每隔 100 毫秒输出一次。按 ESC 退出。注:ESC 的 ASCII 码是 27。 #include <stdio.h> #include <malloc.h>#include<graphics.h>#include<conio.h 阅读全文
posted @ 2016-02-27 14:28 ocean2015 阅读(2459) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <malloc.h>#include<graphics.h> #define LEN sizeof(struct student)#include "math.h"#define PI 3.1415926 void main() {initgr 阅读全文
posted @ 2016-02-27 14:19 ocean2015 阅读(3078) 评论(0) 推荐(0)