Issue with converting from octal to decimal
Hey, I'm trying to write a program that converts a number from octal to decimal, but it's not working out for me.
Here's what I have so far:
# include <math.h>
using namespace std;
int num, x, count=1, res, sum=1, i, y;
cout << "Please enter a number:" << endl;
cin >> num;
for (i=0; i<=count-1; i++)
cout << sum;
But whenever I enter a number it just returns the number of digits. What's wrong here?
This is evaluated from left to right, like this: (res*y) %10;
change it to:
or my preferred style:
Wow thanks so much, didn't notice lol.
Topic archived. No new replies allowed.