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

📄 salestag.c

📁 hello everybody. good lucky to you
💻 C
字号:
// Borland C++ - (C) Copyright 1991 by Borland International

/* SALESTAG.C--Example from Getting Started.
   SALESTAG.C calculates a sales slip. */

#include <stdio.h>
#define RATE 0.065                         /* Sales Tax Rate */

float tax (float amount);
float purchase, tax_amt, total;

int main()
{
   char inbuf [130];
   printf("Amount of purchase: ");
   gets(inbuf);
   sscanf(inbuf, "%f", &purchase);

   tax_amt = tax(purchase);
   total = purchase + tax_amt;

   printf("\nPurchase is:  %f", purchase);
   printf("\n        Tax:  %f", tax_amt);
   printf("\n      Total:  %f", total);

   return 0;
}

float tax (float amount)
{
   return(amount * RATE);
}

⌨️ 快捷键说明

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