编程题:输入一个数字,实现逆排功能。#include<stdio.h>#include<conio.h>fun(intm,char*s){charc;intk,i=10;while(m!=0){k=m%i;*s=k+‘0‘;s++;m=(m-k)/i;}*s=‘\0‘;}main(){intn;chars[81],*p;p=s;printf("enteranumber(>100):");scanf("%d",&n);fun(n,s);p..
分类:
其他 时间:
2014-05-20 17:58:37
收藏:
0 评论:
0 赞:
0 阅读:
350
编程题:输入一串字符,程序会自动将大写字母转换为小写#include<stdio.h>#include<conio.h>main(){ inti=0; chara[50],ch; printf("输入一串字符,程序会自动将大写字母转换为小写\n"); printf("按任意键继续,按Esc键退出\n"); while(ch=getch()!=27) { fflush(..
分类:
其他 时间:
2014-05-21 02:45:41
收藏:
0 评论:
0 赞:
0 阅读:
590
Ubuntu被远程后NumLock键不停闪临时解决办法:方法一:在远程之前先让其关掉自己的NumLock键方法二:关闭NumLock键点击SystemSettings-KeyboardLayout-Options-UsekeyboardLEDtoshowalternativelayout-选中NumLock-Close
分类:
其他 时间:
2014-05-20 17:24:35
收藏:
0 评论:
0 赞:
0 阅读:
392
编程题:文件读写fprintf()、fscanf()使用,功能:将5个学生记录输入文件d:\stu1.txt中,并且显示在屏幕上。#include<stdio.h>voidmain(){FILE*fp;longnum;intn,score;charname[20];intN=5;fp=fopen("d:\\stu1.txt","w");for(n=1;n<=N;n++){scanf("%s%10ld%d",na..
分类:
其他 时间:
2014-05-21 01:22:32
收藏:
0 评论:
0 赞:
0 阅读:
463
编程题:输入文件名,输出该文件的内容。fgetc(fp)的使用。#include<stdio.h>voidmain(){FILE*fp;charout_ch,f_name[30];scanf("%s",f_name);fp=fopen(f_name,"r");if(fp!=NULL){while((out_ch=fgetc(fp))!=EOF)putchar(out_ch);}elseprintf("\n\n\t\t%s文件不存在。\n",..
分类:
其他 时间:
2014-05-20 18:35:14
收藏:
0 评论:
0 赞:
0 阅读:
372
编程题:指针变量指向结构体数组。#include<stdio.h>voidmain(){structperson{charname[20];charsex;intage;floatheight;}per[3]={{"LiPing",‘M‘,20,175},{"WangLing",‘F‘,19,162.5},{"ZhaoHui",‘M‘,20,178}};structperson*p;for(p=per;p<per+3;p++)printf("%-18s%3c%..
分类:
其他 时间:
2014-05-20 18:56:47
收藏:
0 评论:
0 赞:
0 阅读:
441
编程题:枚举变量作为循环控制变量#include<stdio.h>voidmain(){enumseason{spring=1,summer,autumn,winter}s;for(s=spring;s<=winter;s++) printf("%d\n",s);}
分类:
其他 时间:
2014-05-20 21:26:20
收藏:
0 评论:
0 赞:
0 阅读:
457
编程题:为枚举类型变量赋值。将整型值强制类型转换成枚举类型赋值#include<stdio.h>voidmain(){enumseason{spring,summer,autumn,winter}s1,s2;s1=summer;s2=(enumseason)2;printf("s1=%d,s2=%d\n",s1,s2);}
分类:
其他 时间:
2014-05-20 17:50:33
收藏:
0 评论:
0 赞:
0 阅读:
380
#include<stdio.h>voidmain(){enumseason{spring=1,summer,autumn,winter}s;for(s=spring;s<=winter;s++) printf("%d\n",s);}
分类:
其他 时间:
2014-05-20 19:48:19
收藏:
0 评论:
0 赞:
0 阅读:
526
编程题:引用共用体变量的成员#include<stdio.h>voidmain(){uniontemp{chara;intb;}t;t.a=66;t.b=266;/*266=256+10即266的二进制为100001010,所以高字节放低字节放10*/printf("%x:%d,%x:%d\n",&t.a,t.a,&t.b,t.b);}分析代码的算法:运行结果:
分类:
其他 时间:
2014-05-20 22:43:41
收藏:
0 评论:
0 赞:
0 阅读:
510
编程题:结构体数组的引用。功能:输出结构体数组各元素的成员值#include<stdio.h>voidmain(){structperson{charname[20];charsex;intage;floatheight;}per[3]={{"LiPing",‘M‘,20,175},{"WangLing",‘F‘,19,162.5},{"ZhaoHui",‘M‘,20,178}};inti;for(i=0;i<3;i++)print..
分类:
其他 时间:
2014-05-20 21:30:30
收藏:
0 评论:
0 赞:
0 阅读:
533
编程题:展示对整个结构体变量的引用的其他方法。功能:对整个结构体变量进行操作。#include<stdio.h>voidmain(){structperson{charname[20];charsex;structdate {intyear; intmonth; intday; }birthday; floatheight;}per1,per2={"LiPing","M",2013,12,15,175.5};per1=p..
分类:
其他 时间:
2014-05-21 00:20:08
收藏:
0 评论:
0 赞:
0 阅读:
557
谈到httpclient的话,只要会想到apache的httpclient和jetty的httpclient,但是apache的httpclient3和4之间又有区别,通过学些,最终总结了三种方式使用HttpClient,分别为使用httpclient3,httpclient4,jetty的httpclient,下面分别来贴代码:第1种:使用的jar包为commons-htt..
分类:
其他 时间:
2014-05-21 00:39:04
收藏:
0 评论:
0 赞:
0 阅读:
561
keepalived是一款c语言写的实现在linux系统上实现负载均衡和高可用的软件。它遵从于GNU是一款优秀的开源软件。一:两个关键词的解释1:负载均衡keepalived内置了对ipvs函数的调用支持。可以直接在keepalived中按照语法配置ipvs然后keepalived就可以实现对ipvs的配置。2:高可用..
分类:
其他 时间:
2014-05-21 01:26:30
收藏:
0 评论:
0 赞:
0 阅读:
379
编程题:对结构体变量中成员的引用展示。#include<stdio.h>voidmain(){structperson{charname[20];charsex;structdate {intyear; intmonth; intday; }birthday; floatheight;}per;printf("Enterthename:");gets(per.name);per.sex=‘M‘;per.birthday.year=2013;per.birthd..
分类:
其他 时间:
2014-05-20 18:40:36
收藏:
0 评论:
0 赞:
0 阅读:
501
编程题:使用指向指针的指针#include<stdio.h>voidmain(){staticchar*str[]={"How","are","you"};char**p;p=str+1;printf("%s\n",*p);printf("%c\n",**p);}
分类:
其他 时间:
2014-05-21 02:51:19
收藏:
0 评论:
0 赞:
0 阅读:
437
编程题:比较指向数组元素的指针变量和指向数组的指针变量的不同。#include<stdio.h>voidmain(){inta[2][3]={1,2,3,4,5,6};int*p1,(*p2)[3];/*p1指向数组元素,p2指向包含3个元素的一维数组*/p1=a[0];p2=a;/*用指向数组元素的指针变量输出二维数组元素*/for(;p1<a[0]+..
分类:
其他 时间:
2014-05-20 17:49:08
收藏:
0 评论:
0 赞:
0 阅读:
416
编程题:指向二维数组元素的指针变量。功能:已知二维数组a[2][3],输入输出全部元素。#include<stdio.h>voidmain(){inta[2][3],i,j;int*p;/*用坐标法输入二维数组元素*/for(i=0;i<2;i++)for(j=0;j<3;j++)scanf("%d",&a[i][j]);/*用指针法输出二维数组元素*/p=a..
分类:
其他 时间:
2014-05-20 20:10:27
收藏:
0 评论:
0 赞:
0 阅读:
490
编程题:指针数组实现,将多个字符串按字母顺序输出。#include<stdio.h>voidsort(char*str[],intn){char*temp;inti,j,k;for(i=0;i<n-1;i++){k=1;for(j=i+1;j<n;j++)if(strcmp(str[k],str[j])>0)k=j;if(k!=i){temp=str[i];str[i]=str[k];str[k]=temp;}}}voidmain..
分类:
其他 时间:
2014-05-20 18:58:15
收藏:
0 评论:
0 赞:
0 阅读:
470
编程题:指向函数的指针,求两个数中较大的数。#include<stdio.h>intmax(x,y){intz;if(x>y)z=x;elsez=y;returnz;}voidmain(){inta,b,c;int(*p)();p=max;scanf("%d,%d",&a,&b);c=(*p)(a,b);printf("%d,%d,maxis%d\n",a,b,c);}
分类:
其他 时间:
2014-05-20 21:07:21
收藏:
0 评论:
0 赞:
0 阅读:
611