C++ local variables for counting

Description

C++ local variables for counting

#include <iostream>
using namespace std;
int main()/*from  w  ww . j a v a 2  s .  c o  m*/
{
   int i;                  
   i = 10;
   {
      int i;               
      i = 20;              
      cout << i << " " << i  << "\n";
      {
         int i;     
         i = 30;    
         cout << i << " " << i << " " << i << "\n";       
      }                 
   }
   cout << i << " " << i << " " << i << "\n";         
   return 0;
} 



PreviousNext

Related