• <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 閱讀(288) 評論(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.

            精品久久人人妻人人做精品| 久久久免费精品re6| 久久本道久久综合伊人| 久久人妻少妇嫩草AV无码蜜桃| 伊人精品久久久久7777| 麻豆一区二区99久久久久| 99久久国产综合精品网成人影院| 久久国产三级无码一区二区| 久久久久青草线蕉综合超碰| 久久综合丝袜日本网| 99久久无色码中文字幕人妻| 老司机国内精品久久久久| 久久AV高潮AV无码AV| 色综合久久综精品| 久久国产亚洲精品无码| 午夜精品久久久久9999高清| 国产精品99久久精品| 亚洲中文精品久久久久久不卡| 久久精品国产精品青草| 亚洲狠狠婷婷综合久久蜜芽| 日韩久久久久中文字幕人妻 | 国产精品99久久久精品无码| 国产精品久久自在自线观看| 久久精品久久久久观看99水蜜桃| 99久久精品无码一区二区毛片 | 国产精品久久久天天影视香蕉| 亚洲国产美女精品久久久久∴ | 国产成人精品久久二区二区| 国产成人久久精品一区二区三区 | 色偷偷88888欧美精品久久久| 欧美久久久久久| 美女久久久久久| 久久精品一区二区三区中文字幕| 91久久成人免费| 国产91久久综合| 久久久久亚洲AV成人网人人网站| 国产国产成人久久精品| 久久久久亚洲AV无码专区网站| 久久电影网| 中文字幕精品无码久久久久久3D日动漫 | 久久综合九色综合网站 |