C++ Loop Conversion integer to binary

This program is basically working. I'm very knew to C++, so basically I need instructions as if you were explaining this to your grandma. I need this to loop and I have no idea how to incorporate one. Basic code (while loops). Here is what I've done so far. Please help!!

#include <iostream>
using namespace std;
int main () {
int i, c, k;
cout << "Please enter a number to convert: ";
cin >> i;
cout << endl;
cout << i;
cout << " in base 2 is ";
for (c = 10; c >= 0; c--) {
k = i >> c;
if (k & 1)
if (i == 0) {
cout << "0";
cout << endl;
cout << "Thanks for playing!";
cout << endl;
cout << endl;
return 0;
I have found that it's a thankess task and a waste of (my) time to explain things line by line. For example, http://www.cplusplus.com/forum/general/107138/

If you could be clear on what you want done, we might be able to offer some advice.
I need the program to have a while loop. It needs to keep asking for an integer until the user enters 0, then it can stop. I'm not trying to waste your time.
Add the beginning of the while after you've taken the user input. If should look something like:
while (i != 0)

You need to prompt for input again at the end of the loop.
Thank you! I did finally figure it out to include the whole code it the while loop. I just have a hard time understanding what the while loops show say.
Topic archived. No new replies allowed.