I'm completly new on c++, recently on my college I got this class and now I need to do some homeworks...so, here is what I need to do:
On start u enter three digit number (program is checking that number) and when you enter it, program finds biggest three digit number which can be from that number.
It's like u enter 123, program finds it 321.
Easy one I think, but I stucked a little bit :D
EDIT:
For now I got this far:
int number;
cout<<"Enter three digit number that bla bla bla bla!"<<endl;
cout<<"*************************************************"<<endl;
cout<<"Enter three digit number: ";
cin>>number;
if (number<100 || number>999) {
cout<<"Number that you entered doesn't have three digits!" ;
That's the point where I stopped...and I translated it on english btw so you could understand it :)
I wont give you the answer but ill give you a hint. I solve this type of problem of breaking up a token'ed number using modulus and division. because essentially what you need is for the computer to see that one number token as 3 diff numbers that you can then manipulate
Still don't get it...i'm trying with else command, but in every try, i fail...and i'm assuming that i missed something in command i wrote up here too, cause when i enter two digit number, it doesn't repeat "Enter three digits number: ", it end's the program after that.
take a pencil and paper and figure out how you can disect the number 123 mathematically (I.E seperate 1, 2 and 3 ) Again i would reccomend using division and modulus.
EDIT: Just in case: Modulus means: 123/100 = 1 with a remainder of 23 so the mod of 123/100 = 23.
Also remember that when you devide 123/100 on a calculator you will get 1.23 on a computer using intyou have a advantage because it will automatically round that to a 1.
I just gave away how you would do it for one of the numbers try playing around with the rest. If you still dont get it let me know
if you find a method that works test that method on a few more numbers to really make sure it works.