⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 al4_7.c

📁 the examples of c codes.it is very easy,but the basic is important
💻 C
字号:
/*案例代码文件名:AL4_7.C。*/
/*功能:已知利润求薪水。*/
main()
{ long  profit;
  int  grade;
  float  salary=500;
  printf("Input  profit: ");
  scanf("%ld", &profit);
  grade= (profit – 1) / 1000;			/* 将利润-1、再整除1000,转化成switch语句中的case标号 */
  switch(grade)
  { case  0:  break;						/*profit≤1000 */
    case  1: salary += profit*0.1; break;	/*1000<profit≤2000 */
    case  2: 
    case  3: 
    case  4: salary += profit*0.15; break;	/*2000<profit≤5000 */
    case  5: 
    case  6: 
    case  7: 
    case  8: 
    case  9: salary += profit*0.2; break;	/*5000<profit≤10000 */
    default: salary += profit*0.25;		/*10000<profit */
  }
  printf("salary=%.2f\n", salary);
}

⌨️ 快捷键说明

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