• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天之道

            享受編程的樂趣。
            posts - 118, comments - 7, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            The credit card codes

            Posted on 2011-09-23 01:13 hoshelly 閱讀(295) 評論(0)  編輯 收藏 引用 所屬分類: C++


            Tonight I was studying the credit card codes, all of these was copied from my book,"C++ ——how to program".

            This are the program demand:
            1)Account number(an integer);
            2)Balance at the begining of the month;
            3)Total all items charged by this customer this month;
            4)Total of all items applied to this customer's account this month;
            5)Allowed credit limit.


            The program should input each of these facts, calculate the new balance(=begining balance+charges-credits) and determine if the new balance exceeds the customer credit limit.
            For those customers whose credit limit is exceeded, the program should display the customer's account number,credit limit,new balance and the message "Credit limit exceeded".

            #include<iostream>
            #include
            <iomanip>// formatting integers and the precision of floating point values
            using namespace std;

            int main()
            {
                
            int accountNumber;
                
            double balance,charges,credits,limit;

                cout
            <<"Enter account number(-1 to end):"
                    
            <<setiosflags(ios::fixed|ios::showpoint);// to convert data from fixed point number representation to floating point representation
                cin>>accountNumber;
                
            while(accountNumber!=-1)
                
            {
                    cout
            <<"Enter beginning balance:";
                    cin
            >>balance;
                    cout
            <<"Enter total charges: ";
                    cin
            >>charges;
                    cout
            <<"Enter total credits:";
                    cin
            >>credits;
                    cout
            <<"Enter credit limit:";
                    cin
            >>limit;
                    balance
            +=charges-credits;

                    
            if(balance>limit)
                        cout
            <<"Account:  "<<accountNumber
                            
            <<"\nCredit limit: "<<setprecision(2)<<limit //accurate to two decimal point
                            
            <<"\nBalance:    "<<setprecision(2)<<balance
                            
            <<"\nCredit Limit Exceeded.\n";
                    cout
            <<"\nEnter account number(-1 to end): ";
                    cin
            >>accountNumber;
                }


                cout
            <<endl;
                
            return 0;
            }


             

            input -1 and the program will be ended.

            久久久久99精品成人片试看| 久久综合九色综合久99| 伊人久久国产免费观看视频| 国产免费福利体检区久久| 2022年国产精品久久久久| 久久亚洲春色中文字幕久久久| 日本五月天婷久久网站| 久久精品三级视频| 久久精品国产欧美日韩| 久久亚洲国产成人影院网站| 久久久WWW成人| 亚洲国产精品无码久久九九| 久久精品国产99久久丝袜| 久久久久综合国产欧美一区二区| 久久精品一区二区影院| 亚洲性久久久影院| 亚洲国产精品无码久久久蜜芽| 色88久久久久高潮综合影院 | 久久久久亚洲精品无码蜜桃| 国内精品伊人久久久久妇| 久久久亚洲AV波多野结衣 | 88久久精品无码一区二区毛片| 久久久久免费精品国产| 国产精品欧美亚洲韩国日本久久| 日韩久久无码免费毛片软件| 久久狠狠爱亚洲综合影院 | 99久久亚洲综合精品网站| 久久久精品无码专区不卡| 99精品久久久久久久婷婷| 99久久777色| 久久综合九色欧美综合狠狠| 久久久一本精品99久久精品66| 久久99精品国产99久久6男男| 久久丝袜精品中文字幕| 精品免费久久久久久久| 久久久久国产精品麻豆AR影院 | 久久精品国产亚洲Aⅴ蜜臀色欲| 色欲综合久久躁天天躁| 91视频国产91久久久| 精品久久久一二三区| 99久久国产综合精品网成人影院|