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

            亚洲精品国产综合久久一线| 久久久久久久久久免免费精品| 少妇久久久久久久久久| 久久久久久国产精品无码超碰 | 国产精品无码久久久久| 久久这里有精品| 久久精品国产亚洲综合色| 久久综合视频网站| 国产精品久久永久免费| 亚洲午夜久久久久久久久电影网| 青草影院天堂男人久久| 久久精品国产乱子伦| 精品久久人人妻人人做精品| 久久久久国产精品熟女影院| 无码国内精品久久综合88| 日韩亚洲欧美久久久www综合网| 久久99热这里只频精品6| 精品视频久久久久| 久久精品毛片免费观看| 久久99久久99精品免视看动漫| 色婷婷综合久久久久中文字幕| 亚洲国产精品婷婷久久| 97久久超碰国产精品旧版| 久久综合给合久久国产免费| 久久精品国产亚洲AV影院 | 777米奇久久最新地址| 久久午夜伦鲁片免费无码| 亚洲国产精品无码久久久蜜芽| 伊人久久大香线蕉综合影院首页| 免费精品久久久久久中文字幕| 久久96国产精品久久久| 国产精品久久久久影院嫩草| 2021精品国产综合久久| 91精品久久久久久无码| 国产成人精品久久亚洲| 久久99精品久久久久久9蜜桃| 久久www免费人成精品香蕉| 国产精品永久久久久久久久久| 久久久久久国产a免费观看不卡| 久久激情亚洲精品无码?V| 中文字幕精品久久|