- 博客(11)
- 收藏
- 关注
原创 C语言switch语句
#include "stdio.h" int main(int argc,char *argv[]) { printf("please input a number:\n"); int num; scanf("%d",&num); printf("\n"); while(1){ switch(num) { case 1: printf("you input num is:%d
2012-03-26 23:22:05 347
原创 C语言读文件(一)
#include "stdio.h" int main(int argc,char *argv[]) { FILE *fp; char ch; fp=fopen("one.txt","rt"); if(fp==NULL) { printf("can not one.txt\n"); getch(); exit(1); } printf("now i can read a
2012-03-26 22:17:24 337
原创 C语言写文件操作(一)
#include "stdio.h" int main(int argc,char *argv[]) { FILE *fp; char ch; fp=fopen("one.txt","wt+"); if(fp==NULL) { printf("can not this file"); getch(); exit(1); } printf("please input a
2012-03-26 22:03:46 238
原创 C语言 写文件操作
#include "stdio.h" int main(int argc,char *argv) { FILE *fp; char ch; if((fp=fopen("aaa.txt","wt+"))==NULL) { printf("Cannot open file!"); getch(); exit(1); } printf("input a string:\n")
2012-03-22 23:40:59 292
原创 C语言 指针连接字符串(二)
#include "stdio.h" int main(int argc,char * argv[]) { char *connect(char *s1,char *s2); char s1[80],s2[80]; gets(s1); gets(s2); puts(connect(s1,s2)); return 0; } char *connect(char *s1
2012-03-22 14:24:03 1037
原创 C语言连接字符串
#include "stdio.h" int main(int argc,char * argv[]) { char c[40]; char a[20]="ab"; char b[20]="cd"; strcpy(c,strcat(a,b)); printf("c=%s\n",c); // printf(strcat(a,b)); return 0; }
2012-03-22 13:10:28 417
原创 C语言 指针连接两个字符串(一)
#include "stdio.h" int main(int argc,char *argv[]) { char *mystr(char *s1,char *s2); char s1[80],s2[80]; gets(s1); gets(s2); puts(mystr(s1,s2)); return 0; } char *mystr(char *s1,char *s2
2012-03-22 11:15:48 1658
原创 C语言 strcat连接符
#include "stdio.h" int main(int argc,char *argv[]) { char buf[100]="i love"; char *tem="you !"; strcat(buf,tem); puts(buf); getchar(); return 0; }
2012-03-21 23:55:19 339
原创 C语言 头文件(.h)使用方法
//abing.h #include "stdio.h" int plus(int one,int two); char show(char a,char b); //plus.c #include "stdio.h" int plus(int one,int two) { int c=0; c=one+two; return c; } //s
2012-03-21 23:37:06 798
原创 C语言生成TXT文件
#include int main(int argc,char *argv[]) { FILE *fp; fp=fopen(argv[1],"w"); fputs("i love you",fp); fclose(fp); return 0; } Microsoft Windows [版本 6.1.7600] 版权所有 (c) 2009 Micro
2012-03-20 00:03:42 2945
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人