🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #676

integer properties

#676
From: David Eynon
Date: Thu, 30 Jan 2003 12:50
60 lines
2797 bytes
//NOTES: When account number is entered as a large number in the beginning,
the program
// terminates. When account number is entered as a large number in the
middle
//  an infinite loop occurs. Why is this?

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
  int acct; //account number
  double begbal = 0;
  double tcharges = 0; //total charges
  double tcredits = 0; //total credits
  double limit = 0;  //credit limit.

  cout << "Enter account number (-1 to stop)";
  cin >> acct;

  while (acct > 0)
  {
   cout << "Enter beginning balance:";
   cin >> begbal;

   cout << "Enter total charges:";
   cin >> tcharges;

   cout << "Enter total credits:";
   cin >> tcredits;

   cout << "Enter your credit limit:";
   cin >> limit;

   if ((begbal + tcharges - tcredits) > limit)
   {
    cout << "Account number: " << acct << endl;
    cout << "Balance: " << (begbal + tcharges - tcredits) << endl;
    cout << "Credit limit of " << limit << " has been exceeded"<< endl;
    //cout << endl;
   } // end if

   //next "Cycle"
   cout << endl;
   cout << "Enter account number (-1 to stop)";
   cin >> acct;
  } //while


   return 0;

} //main



      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]
Technical Details
Message-ID: <wk0_9.474$Pe7.97@nwrddc04.gnilink.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!crtntx1-snh1.gtei.net!chcgil2-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!uwm.edu!rpi!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10b7bb,1e14887de54a4921,start
X-Google-Attributes: gid10b7bb,public
X-Google-Thread: fc772,1e14887de54a4921,start
X-Google-Attributes: gidfc772,public
X-Google-Thread: 109fba,1e14887de54a4921,start
X-Google-Attributes: gid109fba,public
X-Google-Thread: 114592,1e14887de54a4921,start
X-Google-Attributes: gid114592,public
X-Google-ArrivalTime: 2003-01-30 04:48:20 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!crtntx1-snh1.gtei.net!chcgil2-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!uwm.edu!rpi!not-for-mail
From: "David Eynon" <david.eynon@verizon.net>
Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c++,comp.lang.c++.moderated,ctdl.lang.c++
Subject: integer properties
Date: 30 Jan 2003 07:50:04 -0500
Organization: unknown
Lines: 60
Sender: cppmods@netlab.cs.rpi.edu
Approved: francis.moderator@robinton.demon.co.uk
Message-ID: <wk0_9.474$Pe7.97@nwrddc04.gnilink.net>
NNTP-Posting-Host: netlab.cs.rpi.edu
X-Original-Date: Thu, 30 Jan 2003 02:44:44 GMT
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated
 iQBUAwUAPjkfdkHMCo9UcraBAQEL9gH3bW8VOqG5ATgbOfhuf/xeMGXhSQQiB33H
 2aUmGEPjVHBrc0xjZmEC9aLUb+GRK4plgeh86+VhoPsWqsiMMvCk
 =TGof