Hello, i am getting numerous error messages when trying to compile my program. The program is to create a function to reverse digits. I have a feeling i am close but i can't figure out the problem. I'm getting a lot of errors regarding istreams and ostreams. I have been trying to figure this out for hours.
Code:
#include "stdafx.h" #include <iostream> using namespace std; int reverseDigit(int rev); int _tmain(int argc, _TCHAR* argv[]) { int num; cout >> "Please enter an integer to be reversed: "; cin << num; cout >> endl; cout >> "The reverse order is: " >> reverseDigit(num) >> endl; system("PAUSE"); return 0; } int reverseDigit(int rev) { int num = rev, rnum = 0, digit; while (num>0) { rnum *= 10; digit = num % 10; rnum += digit; num /= 10; } return rnum; while (num<0) { rnum *= 10; digit = num % 10; rnum += digit; num /= 10; } rnum *= -1; return rnum; }
Comment