Chinaunix首页 | 论坛 | 博客
  • 博客访问: 99262
  • 博文数量: 102
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1011
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-15 13:58
个人简介

普普通通一个人

文章分类

全部博文(102)

文章存档

2018年(1)

2015年(13)

2014年(88)

我的朋友

分类: C/C++

2014-01-17 17:10:02


点击(此处)折叠或打开

  1. /* The base salary is $200 per-week, bonus is sale * 9%, input the sale, output actual salary */
  2. #include<stdio.h>
  3. int main(){
  4.     int int_sales = 0;/* declare and initialize the sales */
  5.     float float_actual_salary; /* declare and initialize the actual salary */

  6.     /* prompt */
  7.     printf("Enter sales in dollars (-1 to end): ");
  8.     scanf("%d", &int_sales);

  9.     /* if the sales is not -1, then calculate the actual salary */
  10.     while(int_sales != -1){
  11.         /* calculate the actual salary */
  12.         float_actual_salary = 200 + int_sales * 0.09;
  13.         /* output the actual salary on screen */
  14.         printf("Salary is: %.2f\n", float_actual_salary);
  15.         /* prompt */
  16.         printf("Enter sales in dollars (-1 to end): ");
  17.         scanf("%d", &int_sales);
  18.     }

  19.     return 0;
  20. }

阅读(196) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~