First programm

Hello,
I'm new at C++ programming....i have never programmed befor so im having a hard time. I'm writing binary calculator...i want to read string of "1" and "0" to var. "bin" and then, for now just display it reversed. I have this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

int main(){
   string bin;
   int a,i;
   cout << "Give binary code: ";
   cin >> bin;
   for( i=bin.size() ; i=0; i-1){
      cout << bin[i] << "  ";//You can access each character in a string like an array
                             //Not the best way but a good way to start
   }
   system("pause");
   return 0;
}


Part of this...allmost all of this i have found on this forum...i just wanted to display it backwards...and i cant get it right. I really need help. I don;t know what part is wrog. Help.
Your for loop conditions are wrong. I think you want to change i=0 to i>=0. i=0 just sets i to zero again.
Topic archived. No new replies allowed.