摘要: //fputc.c#include <stdio.h>int main(){ /*int fputc(int ch,FILE *p);送一个字符到一个流中*/char *p="abcdefgh";while(*p!='\0'){fputc(*p,stdout);p++;}printf("\n");return 0;} 阅读全文
posted @ 2013-03-06 21:08 王井玉 阅读(453) 评论(0) 推荐(0) 编辑
摘要: //strcpy.c#include <stdio.h>#include <windows.h>int main(){/*exterm strcpy(char *dest,char *src);将src字符串中的内容复制到dest所指的字符中.返回指向dest字符串的指针.*/char *d="abcdefgh";char p[20]="";system("cls");strcpy(p,d);printf("%s\n",p);return 0;} 阅读全文
posted @ 2013-03-06 20:35 王井玉 阅读(431) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <windows.h>int main(){/*strncat的用法extern char *strncat(char *dest,char *src,int n);将src所指字符串的n个字符填加到dest所指的字符串尾部*/char d[20]="abcd";char *p="efgh";system("cls");strncat(d,p,4);printf("%s\n",d);return 0;} 阅读全文
posted @ 2013-03-06 19:57 王井玉 阅读(699) 评论(0) 推荐(0) 编辑
摘要: #include <windodws.h>system("cls"); 阅读全文
posted @ 2013-03-06 17:43 王井玉 阅读(382) 评论(0) 推荐(0) 编辑
摘要: filename 必需。规定要打开的文件或 URL。 mode 必需。规定要求到该文件/流的访问类型。可能的值见下表。 include_path 可选。如果也需要在 include_path 中检索文件的话,可以将该参数设为 1 或 TRUE。 context 可选。规定文件句柄的环境。Context 是可以修改流的行为的一套选项。 "r" 只读方式打开,将文件指针指向文件头。 "r+" 读写方式打开,将文件指针指向文件头。 "w" 写入方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。 "w+& 阅读全文
posted @ 2013-03-05 21:51 王井玉 阅读(205) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <dos.h>int main(){ /*getdate()函数的用法*/ struct date d; getdate(&d); //获取DOS日期 printf("the current year is:%d\n",d.da_year);//cprintf和printf用法是不同的 printf("the current day is:%d\n",d.da_day); printf("the current month is:%d\n",d.da 阅读全文
posted @ 2013-03-05 09:11 王井玉 阅读(1399) 评论(0) 推荐(0) 编辑
摘要: #include <conio.h>int main(void){ /*gotoxy()的用法*/ //clrscr(); //清除文本模式的窗口 gotoxy(2,1);//在文本窗口中设置光标用(列,行) cprintf("Hello world");//送格式化输出至屏幕 getch(); return 0;} 阅读全文
posted @ 2013-03-05 07:44 王井玉 阅读(1045) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*getchar()从输入设备 得到一个字符,这个 字符显示在屏幕上 getch从输入设备得到 一个字符,但是这个 字符不显示在屏幕上*/ printf("%c",getchar()); printf("%c",getch()); return 0;} 阅读全文
posted @ 2013-03-04 20:45 王井玉 阅读(197) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <conio.h>#include <stdlib.h>#include <time.h>int main(){ /*时间函数4:猜数字游戏*/ int i,guess; char c; double var; time_t a,b; clock_t start,end; srand(time(NULL)); printf("\ndo you want to play a game.('y'or'n')\n"); loop: while((c 阅读全文
posted @ 2013-03-04 20:43 王井玉 阅读(171) 评论(0) 推荐(0) 编辑
摘要: /*calculate time*/#include <stdio.h>#include <conio.h>#include <time.h>int main(){ /*时间函数举例3*/ clock_t start,end; int i; double var; // 这是怎么回事啊 start=clock(); for (i=0;i<10000;i++) printf("\1\1\1\1\1\1\1\1\1\1\n"); end=clock(); printf("\1:the different time is %6. 阅读全文
posted @ 2013-03-04 14:51 王井玉 阅读(240) 评论(0) 推荐(0) 编辑