tc9.c

来自「关于学习C语言的电子书籍」· C语言 代码 · 共 35 行

C
35
字号
/*****************
	tc9.c
   货物托运
******************/

#include "stdio.h"
main( )
{
	int weight;
	float cost;				
	printf("    货物托运 \n\n");
	printf("请输入货物重量:"); 	
	scanf("%d",&weight);
	switch(weight/100)
	{
		case 0:
			cost=weight*3.5;
			break;
		case 1:
			cost=weight*3.2;
			break;
		case 2:
			cost=weight*3;
			break;
		case 3:
			cost=weight*2.8;
			break;
		default:
			cost=weight*2.5;
			break;
	}
	printf("货物重量为%d,应付费用%.2f.\n",weight,cost);

			
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?