数值交换

数值交换

/* 功能:数值交换 日期:2013-05-16 */ #include <stdio.h> #include <stdlib.h> #include <math.h> #define LEN 10 int main(void) { int num[LEN] = {0}; int max,min,tmp,i; printf(“请输入10个数字:”); //求最大值与最小值 max = min = num[0]; for (i=0;i<=LEN-1;i++) { scanf(“%d”,&num[i]); if(num[i]>max) { max = num[i]; } if(num[i]<min) { min = num[i]; } } //最大的与第一个交换 for(i=0;i<=LEN-1;i++) { if(num[i]==max) { tmp = num[0]; num[0] = max; num[i] = tmp; } } //最小的与最后一个交换 for(i=0;i<=LEN-1;i++) { if(num[i]==min) { tmp = num[LEN-1]; num[LEN-1] = min; num[i] = tmp; } } //输出 for (i=0;i<=LEN-1;i++) { printf(“%d “,num[i]); } printf(“n”); system(“pause”); return 0; }

图层复合、快照的效果

图层复合、快照的效果

使用方式: 快照:历史记录面板>右键>新建快照。 图层复合:窗口>图层复合>点击复合板下方对应按钮创建新的图层复合。 共同点: 快照、图层复合、多个JPEG或PSD均可保存一定时间内的图像,使操作可以继续时再回到之前的操作效果。 不同点: JPEG保存后无法修改;多个PSD占硬盘空间大; 快照,再打开就没有了。 图层复合:可以随文件保存。

求一个班学生的数学平均成绩、最高分、最低分

求一个班学生的数学平均成绩、最高分、最低分

/* 功能:求一个班学生的数学平均成绩、最高分、最低分 日期:2013-05-08 */ #include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { int maths,maxMath,minMath,sum,i; float aveMatrh; printf(“请输入本班所有学生的成绩:n”); maxMath=0; minMath=maths; for(sum=0,i=0;maths>=0;i++) { scanf(“%d”,&maths); if (maths>=0) { maxMath=maxMath>maths?maxMath; minMath=minMath<maths?minMath; sum+=maths; } } aveMatrh=(float)sum / (float)(i-1); printf(“这个班学生的平均分为;%.1f,最高分为:%d,最低分为:%dn”,aveMatrh,maxMath,minMath); system(“pause”); return 0; }

摄氏温度——华氏温度对照表

摄氏温度——华氏温度对照表

/* 功能:摄氏温度——华氏温度对照表 日期:2013-05-08 */ #include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { int C; double F; printf(“摄氏温度 华氏温度n”); C = 0; F = C; do { F = (double)C * 9 / 5 + 32.0; printf(“%d %.2lfnn”,C,F); C += 5; }while(C <= 100); printf(“n”); system(“pause”); return 0; }

计算1*2*3+3*4*5+...99*100*101的值

计算1*2*3+3*4*5+...99*100*101的值

/* 功能:计算1*2*3+3*4*5+…99*100*101的值 日期:2013-05-08 */ #include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { int Sum,sum1,sum2,sum3; for (sum1 = 1,sum2 = 2,sum3 = 3,Sum=0;sum3 <= 101;sum1 += 2,sum2 += 2,sum3 += 2) { Sum += sum1 * sum2 * sum3; } printf(“1*2*3+3*4*5+…99*100*101的值为:%dn”,Sum); system(“pause”); return 0; }

求和

求和

1-101基数求和/*功能:求和作者:windCoder日期:2013-05-08*/#include &lt;stdio.h&gt;#include &lt;stdlib.h&gt;#includ

求小球运动路径

求小球运动路径

/* 功能:求小球运动路径 日期:2013-4-19 */ #include <stdio.h> #include <stdlib.h> int main(void) { int n; double hight,s; for (hight=100.0,s=0,n=1;n<=10;n++) { hight=hight/2.0; printf(“第%d次反弹的高度:%.6lfn”,n,hight); s=s+hight; } s=s+100.0; printf(“小球共经过的路程:%.6lfn”,s); system (“pause”); return 0; }

计算平均分

计算平均分

/* 功能:计算平均分 日期:2013-04-01 */ #include<stdio.h> #include<stdlib.h> #include<math.h> int main(void) { double one,two,three,four,five,max,min,average; printf(“请输入5位评委所打的成绩:”); scanf(“%lf,%lf,%lf,%lf,%lf”,&one,&two,&three,&four,&five); max = min = one //求最大值 max = max>two?max; max = max>three?max; max = max>four?max; max = max>five?max; //求最小值 min = min<two?min; min = min<three?min; min = min<four?min; min = min<five?min; //求平均值 average =(one + two + three + four + five - max - min) / 3; printf(“该选手的平均得分是:%.1lfn”,average); system(“pause”); return 0; } ______________________________________________________________________________

字符加密

字符加密

/* 功能:字符加密 日期:2013-04-01 */ #include<stdio.h> #include<stdlib.h> #include<math.h> int main(void) { char One,Two,Three,Four,Five; printf(“请输入5个字符:”); scanf(“%c%c%c%c%c”,&One,&Two,&Three,&Four,&Five); if (One>=97&&One<=122)//第一个字符 { One=( One + 4 - 97 ) % 26 + ‘a’; } if(One>=65&&One<=90) { One=( One + 4 - 65 ) % 26 + ‘A’; } if (Two>=97&&Two<=122)//第二个字符 { Two=(Two + 4 - 97 ) % 26+‘a’; } if (Two>=65&&Two<=90) { Two=(Two + 4 -65 ) % 26 + ‘A’; } if (Three>=97&&Three<=122)//第三个字符 { Three=( Three + 4 - 97 ) % 26 + ‘a’; } if (Three>=65&&Three<=90) { Three=(Three + 4 - 65 ) % 26 + ‘A’; } if (Four>=97&&Four<=122)//第四个字符 { Four=( Four + 4 - 97 ) % 26 + ‘a’; } if ( Four>=65&&Four<=90) { Four=(Four + 4 - 65 ) % 26 + ‘A’; } if ( Five>=97&&Five<=122)//第五个字符 { Five=( Five + 4 - 97 ) % 26 + ‘a’; } if (Five>=65&&Five<=90) { Five=( Five + 4 - 65 ) % 26 + ‘A’; } printf(“加密后的数值是:%c%c%c%c%cn”,One,Two,Three,Four,Five); system(“pause”); return 0; }