自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 用 switch case 修改 7:如图

//用 switch case 修改 7:基本工资 10.00 美元/小时 加班(超过40小时)1.5倍时间 税率 前300美元为%15 下一个150美元为%20 余下的为%25 不关心是否符合税法#include "stdafx.h"#include "stdlib.h"#define LTR 0.15#define STR 0.2#define OTR 0.25int main()

2012-04-30 12:19:54 631

原创 编写程序要求输入一周中的工作小时数 然后打印工资总额 税金 以及净工资

//基本工资 10.00 美元/小时 加班(超过40小时)1.5倍时间 税率 前300美元为%15 下一个150美元为%20 余下的为%25 不关心是否符合税法#include "stdafx.h"#include "stdlib.h"#define BS 10.00#define LTR 0.15#define STR 0.2#define OTR 0.25int main()

2012-04-30 10:51:25 5570

原创 编写一个程序读取输入,直到‘#’,并报告序列 ei 出现的次数

#include "stdafx.h"#include "stdlib.h"int main() { char ch; int i=0; while((ch=getchar())!='#') { if(ch=='e') continue; if(ch=='i') i++; } printf("is %d\n",i); system("pause

2012-04-30 00:52:22 2482 5

原创 用 switchcase语句写一个程序 输入整数 直到输入0 计算偶数的个数 奇数的个数 和偶数的平均值 与奇数的平均值

#include "stdafx.h"#include "stdlib.h"int main() { int a,sum,max=0,ave=0,x=0,y=0; while(scanf("%d",&a)) { if(a==0) break; if(a%2==0) sum=1; else sum=0; switch(sum) {

2012-04-30 00:38:12 4916

原创 用if else语句编写程序读取输入,直到‘#’,用一个感叹号代替原有的句号,用两个感叹号代替原有的感叹号

#include "stdafx.h"#include "stdlib.h"int main() { char ch; int i=0; while((ch=getchar())!='#') { if(ch=='.') ch-=13; else if(ch=='!') putchar(ch); i++; putchar(ch); } s

2012-04-30 00:26:45 5075 4

原创 求一个三乘三矩阵对角线的和

#include "stdafx.h"#include "stdlib.h"int main() { int a[3][3]={{1,2,3},{1,2,3},{1,2,3}}; int i,j,sum=0; printf("This matrix is:\n"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d",

2012-04-29 23:20:15 2648 1

原创 不断地输入温度 当用户输入假值时 如 ‘Q’ 则跳出 计算输入温度累加的平均温度 并输出

#include "stdafx.h"#include "stdlib.h" int main() { int days=0; double ave=0,col; printf("Please input Temperature : "); while(scanf("%lf",&col)==1) { ave+=col;

2012-04-29 22:58:23 1739

原创 Chuckie Lucky 赢了100万美元,他把它存入一个每年赢得8%的帐户。在每年的最后一天,Chuckie取出 10万美元。编写一个程序,计算需要多少年Chuckie就会清空他的帐户。

#include "stdafx.h"#include "stdlib.h" int main() { double luck,sum; int i=0; luck=1000000.0; while(luck>0) { luck-=100000.0-luck*0.08; i++; }

2012-04-29 22:57:58 5723 1

原创 Daphne 以10%的单利息投资了100美元(也就是说,每年投资赢得的利息等于原始投资的10%)。 Deirdre 则以每年5%的复合利息投资了100美元(也就是说,利息是当前结余的5%,其中包括以

#include "stdafx.h"#include "stdlib.h" int main() { int years; const double BASE=100.0; double daphone,deirdre; daphone=BASE; deirdre=BASE; years=0; while(daphon

2012-04-29 22:57:30 3435

原创 一个数组 输入一个数 查找到它的位置 插入合适的位置

#include "stdafx.h"#include "stdlib.h" void main(){ int a[11],i,j,k; printf("Please input ten soccer : "); for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0;i<=9;i++)

2012-04-29 22:56:58 1190

原创 在一个存十个数的数组中 用户输入一个数 查找出该数所在的位置

#include "stdafx.h"#include "stdlib.h" void main(){ int a[10],i,j,k,sum=0; printf("Please input ten numbers: "); for(i=0;i<=9;i++) scanf("%d",&a[i]); for(i=0;i<=9;i++)

2012-04-29 22:56:22 5424

原创 编写一个程序读入一行输入,然后反向打印该行,您可以把输入存储在一个char数组中: 假定该行不超过255个字符。回忆一下,您可以使用具有%c说明符的scanf()从输入中一次 读入一个字符,而且当您按

#include "stdafx.h"#include "stdlib.h" void main(){ int a=0,i=0; char word[255]; printf("Please input a word: "); scanf("%c",&a); while(a<255 && a!='\n') { word

2012-04-29 22:55:31 2996 1

原创 编写一个程序,创建两个8元素的double数组,第一个数组有用户键入8个值,第二个为第一个的累积,例如,第二个数组的第四个元素应该等于第一个数组的前四个元素之和

#include "stdafx.h"#include "stdlib.h" void main(){ int i; double j=0; double num1[8],num2[8]; printf("Please input a double number : \n"); for(i=0;i<=7;i++) { sc

2012-04-29 22:54:50 3830

原创 判断一个数是否为素数

#include "stdafx.h"#include "stdlib.h" void main(){ int num,x,i; printf("Please input a number :_____\b\b\b\b\b"); while(scanf("%d",&num)==1) { for(i=2;i<num;i++) {

2012-04-29 22:54:12 502

原创 编写一个程序 把八个整数读入一个数组中 然后以相反的顺序打印它们

#include "stdafx.h"#include "stdlib.h"int main () { int i,num[8]; printf("Please input number :\n"); for(i=0;i<=7;i++) //循环输入八个整数 scanf("%d",&num[i]); printf("The n

2012-04-29 22:53:39 3922

原创 编写一个程序,要求用户输入下限整数和一个上限整数,然后,依次计算从下限到上限的每一个整数的平方的加和,最后显示结果

#include "stdafx.h"#include "stdlib.h"int main () { int sum=0,i,up,down; printf("\aPlease input up and down:_____\b\b\b\b\b"); scanf_s("%d %d",&up,&down); //输入上限和下限 while(up

2012-04-29 22:52:37 2873

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除