d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > C++ Question
Prev123Next
Add Reply New Topic New Poll
Member
Posts: 31,523
Joined: Mar 31 2004
Gold: 6.57
Oct 21 2013 10:10pm
Quote (SelfTaught @ 21 Oct 2013 23:41)
Google, c++ modulus operator


I know about modulus operator but i dont get how this would help me
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Oct 21 2013 10:33pm
It seems odd that your professor would expect you to cover the case about a string with a % and not tell you how to handle it....
Member
Posts: 31,523
Joined: Mar 31 2004
Gold: 6.57
Oct 21 2013 10:36pm
Quote (Eep @ 22 Oct 2013 00:33)
It seems odd that your professor would expect you to cover the case about a string with a % and not tell you how to handle it....


I finished the project and I have week to send it in I would like to do something extra for fun
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Member
Posts: 31,523
Joined: Mar 31 2004
Gold: 6.57
Oct 21 2013 11:15pm
Quote (SelfTaught @ 22 Oct 2013 00:42)


how does that help me ??


I'm trying to figure out that lets say


cout << "Please enter that sales tax" << endl;
cin >> salesTax;


now what if someone enters in sales tax = 8.25% so if they do that then takes 8.25/100 = .0825


but what if they do this

cout << "Please enter that sales tax" << endl;
cin >> salesTax;


they enter .0825 so then i need to do nothing..


is there a way to tell which the person enters then goes forward?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 21 2013 11:23pm
Quote (Katelyn @ Oct 22 2013 01:15am)

is there a way to tell which the person enters then goes forward?


No, it's not possible. c++ is simply not advanced enough. You can do it in java though.
Member
Posts: 31,353
Joined: Apr 10 2006
Gold: Locked
Oct 21 2013 11:40pm
WOW

MUCH LOGIC

SO EXITED

This post was edited by Sicktricks on Oct 21 2013 11:42pm
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Oct 21 2013 11:55pm
Lol.

.0825 × 100 = 8.25%

If input < 1 then input is decimal
Else
input is %

This post was edited by SelfTaught on Oct 22 2013 12:00am
Member
Posts: 17,177
Joined: Aug 10 2007
Gold: 125.00
Oct 22 2013 12:33am
You could just convert anything the user enters into a decimal. That way you only need one way to calculate it.
Member
Posts: 31,523
Joined: Mar 31 2004
Gold: 6.57
Oct 22 2013 01:04am
Quote (Sicktricks @ 22 Oct 2013 01:40)
WOW

MUCH LOGIC

SO EXITED


going to my recent post to troll me miss me that much?

Quote (SelfTaught @ 22 Oct 2013 01:55)
Lol.

.0825 × 100 = 8.25%

If input < 1 then input is decimal
Else
input is %


great i got it now <3

i knew how to convert decmial into %

This post was edited by Katelyn on Oct 22 2013 01:18am
Go Back To Programming & Development Topic List
Prev123Next
Add Reply New Topic New Poll