kn336a 24 Newbie Poster

Edit: Problem solved Thanks to you guys!

kn336a 24 Newbie Poster
#include <iostream>
using namespace std;

int main()
{
    int num;
    const int MAX = 8;
    int output[8];
    
    cout << "Enter a number [0 - 255]: ";
    cin >> num;
    
    cout << num << "converts to";
    for (int i = 0; i < MAX; i++)
        {
             output[i] = num % 2;
             num = num/2;
        }
    
    for (int i = MAX - 1; i >= 0; i--)
        cout << output[i] << endl; //Compiling error
        if (i % 8 == 0)
        
           cout << "   " << endl;
           
    
    system("pause");
    return 0;

}

Hi, I'm fairly new to programming and I am stuck on one part. The part that I have noted gets a compiling error. When it is removed, the program compiles, but does not make the calculation. Any ideas?

Ancient Dragon commented: Thanks for using code tags correctly on your very first post :) +24