User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 423,629 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,286 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums

class

Join Date: Jan 2007
Posts: 65
Reputation: mauro21pl is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
mauro21pl mauro21pl is offline Offline
Junior Poster in Training

Re: class

  #4  
Aug 7th, 2007
Hi again. I think I found a good way to approach the problem. I think . Look at the code:

 
void Money::input (istream& ins)
{
  cout<<"\n\nYou are going to set up the amount for your_account"<<endl;
  cout<<"Enter the amount to your_account: ";
  bool negative;
  char first_character;
  char decimal_point;
  int first_number,second_number,all_cents;
  
     if (first_character=='-')
    negative=true;
    else negative=false;
    if(negative)
    first_number=-first_number;
    ins>>first_number>>decimal_point>>second_number;
    cout<<first_number<<"."<<second_number;
  
}

What that function return is
the number I entered : -34.56
th eoutput was : -34.560.00

Now I have a new question. How may I delete the last for characters including the dot.
thanks
Reply With Quote  
All times are GMT -4. The time now is 9:36 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC