Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Increment columns using for loop in cpp
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc_,char ** argv_)
  7. {
  8.         for (int i = 1; i <= 3; ++i)
  9.         {
  10.                 cout << "XX-" << i << ", YY-" << i << ", ZZ-" << i;
  11.                 if (i != 3)
  12.                         cout << ", ";
  13.         }
  14.  
  15.         cout << endl;
  16.         return 0;
  17.  
  18. }
  19.        
  20. string x = xx;
  21. string y = yy;
  22. string z = zz;
  23.  
  24. for (int i = 1; i <= 3; i++)
  25. {
  26.      Console.Write(x+ "+"+i +", ");
  27.      Console.Write(y + "+" + i + ", ");
  28.      Console.Write(z + "+" + i + ", ");
  29. }
  30.        
  31. for (int control=1; control<4; control++) {  
  32. cout << "XX-" << control << endl;  
  33. cout << "YY-" << control << endl;  
  34. cout << "ZZ-" << control << endl;  
  35. }