Quote (Eep @ Sep 7 2014 06:56pm)
I know I always tell people to bother him, but KrzaQ has some good C++ knowledge it would seem. I am not sure how far you are looking to go, but if you post your source here he can probably offer some advice if you are into that kind of thing.
Well, It's for a class - SO I'll be going deep enough to pass this, with a minor in CSCI, so I'm looking to learn it well.
Here's the source that i got to work:
#include <iostream>
using namespace std;
void printreverse(int number){
if (number == 0){
cout << ".";
} else {
cout<< (number%10);
printreverse((number/10));
}
}
int main () {
cout << "Please enter an integer to be reversed. \n";
int number;
cin >> number;
cout << "You entered: " << number << ". \n";
cout << "This number reversed is: ";
printreverse(number);
return 0;
}
************************
the while loop that would cause infinite loop was just:
while (number != 0) {
cout<< number%10;
number/10;
}
Still not really sure why that won't work though.
This post was edited by Nort on Sep 7 2014 09:51pm