Hey i need with this program it works, but i cant figure out how to make it not print out zeros when it is reversed. for example when the user types in 123000 it should print out 321. but my program prints out 000321 what can i do to make it print out 321.
#include "stdafx.h"
#include <iostream>
#include <ctype.h>
#include <fstream>
#include <string>
using namespace std;
int reverseDigit, integer, reverse;
int main()
{
string integer;
int cntr;
cout <<"Please input an integer: ";
cin >> integer;
cntr = integer.size();
cntr--;
cout <<"reverse = ";
if (integer [0] == '-')
{
cout << "-";
}
while (cntr > -1)
{
if (integer [cntr] == '-')
cntr--;
else
cout << (integer[cntr--]);
}
cout << endl;
return 0;
}