1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      打折促銷的c語言函數(shù) c語言購物打折編程

      c語言 如何用switch語句編寫一個有關(guān)商場購物金額優(yōu)惠的選擇程序

      #include stdio.h

      站在用戶的角度思考問題,與客戶深入溝通,找到香河網(wǎng)站設(shè)計(jì)與香河網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗(yàn)好的作品,建站類型包括:成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、國際域名空間、虛擬主機(jī)、企業(yè)郵箱。業(yè)務(wù)覆蓋香河地區(qū)。

      int main(int argc, char** argv)

      {

      int amount = 0;

      scanf("%d", amount);//輸入顧客購買的總額

      int status = amount/1000;

      switch (status)

      {

      case 0: break;

      case 1: amount = amount * 0.95; break;

      case 2: amount = amount*0.90; break;

      case 3: amount *= 0.85; break;

      default: amount *= 0.80; break;

      }

      printf("%d\n", amount);//打印出打折后的總額

      return 0;

      }

      用C語言編寫一個程序,要求輸入購買商品的錢款數(shù),輸出相應(yīng)的折扣率?

      你這個題目無法實(shí)現(xiàn)的,因?yàn)檎劭勐蕬?yīng)該是在知道原價的基礎(chǔ)上的。目前給出條件不足。

      這里做個假設(shè):

      如果輸入是兩個,折扣前和折扣的,那么可以計(jì)算,比如:

      float beforePayment,afterPayment;

      float percentage;

      scanf("折扣前金額=%f",beforePayment);

      scanf("折扣后金額=%f",afterPayment);

      percentage=afterPayment/beforePayment;

      printf("產(chǎn)品折扣率為:%.2f",percentage);//保留兩位小數(shù)進(jìn)行顯示

      c#編程,某商場正在促銷打折,購物滿100減50,輸入購買的商品的原價,編寫方法計(jì)算顧客實(shí)際的付款

      Console.WriteLine("請輸入商品原價:");

      decimal pay = Convert.ToDecimal(Console.ReadLine());

      if (pay 100)

      {

      Console.WriteLine("顧客實(shí)際應(yīng)付款{0}元", pay);

      }

      else

      {

      Console.WriteLine("顧客實(shí)際應(yīng)付款{0}元", pay-50);

      }

      Console.ReadKey();

      說明:以上是C#編程,基于.Net平臺進(jìn)行,本人使用的是Visual Studio 2010(語言是C#)

      編寫c語言程序,輸入購物款數(shù),計(jì)算并輸出優(yōu)惠價。(要求用switch語句編寫)

      #include stdio.h

      int main()

      {

      float totalprice=0,level=0; //總的消費(fèi)額,打折等級標(biāo)志

      scanf("%d",totalprice);

      if(totalprice=1000) level=1; //一共分為五等,不同等級,對應(yīng)不同的優(yōu)惠策略。

      else if(totalprice1000 totalprice=2000) level=2;

      else if(totalprice2000 totalprice=3000) level=3;

      else if(totalprice3000 totalprice=5000) level=4;

      else level=5;

      switch(level) //一共分為五等,不同等級,對應(yīng)不同的優(yōu)惠策略。

      {

      case 1: printf("%f",totalprice);break;

      case 2: printf("%f",totalprice*0.95);break;

      case 3: printf("%f",totalprice*0.90);break;

      case 4: printf("%f",totalprice*0.85);break;

      default: printf("%f",totalprice*0.80);break;

      }

      return 0;

      }


      當(dāng)前文章:打折促銷的c語言函數(shù) c語言購物打折編程
      地址分享:http://ef60e0e.cn/article/ddjgjeg.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        永吉县| 义马市| 建德市| 康马县| 独山县| 三台县| 宁津县| 敦化市| 建宁县| 惠水县| 广安市| 甘南县| 平阴县| 都昌县| 邵阳县| 虹口区| 安塞县| 金阳县| 黄山市| 璧山县| 宝兴县| 田林县| 察哈| 天水市| 航空| 孝昌县| 祁东县| 镇江市| 哈巴河县| 柞水县| 苗栗县| 勃利县| 双辽市| 蓝山县| 沭阳县| 福州市| 睢宁县| 武山县| 永清县| 郧西县| 兴安盟|