Monday, July 27, 2009

C++ problem?

i am supposed to do a C++ program that could determine the number i input with the use of the 'switch' and 'break' syntaxes.


ive run the program but it could not read an input higher than the ones digit. i programmed it to a thousand but it could only read up to a thousand when i only input a digit each.


they say the algorithm is 1000/9999*1000/999*100/99*10 but how could i put the algorithm in a C++ language?

C++ problem?
don't understand your question
Reply:Without knowing how you input your number we can't help you.





cin %26lt;%26lt; int Getnumber;





and cin.getline(int Getnumber, 5);





should both work. the %26lt;%26lt; operator should work until it hits a whitespace character. The other should convert an up to 4 digit entry into an int from a string.





What did you use?


No comments:

Post a Comment