Monday, February 27, 2006

/* the devil's code */

Well I was in c++ class the other day and we had to create a nested for loop to display:

1
22
333
4444
55555

Well this is what I came up with on my way to figuring it out:

/* the devil's code */
#include <iostream>
using namespace std;
void main()
{

int x = 0,

z = 0;

cout << endl;

for(x=1; x<=3; x++)

{

for (z=1; z<=5; z++)

cout << z << endl;

}

system ("pause"); // pc pause

return;

}

What came out on the console was:

6
6
6

I looked at the person next to me and said that ain't right, he looked over and cracked up laughing and we persued to disturb the class (somewhat) from the back row. (geeky class Clown)

disclaimer: I don't worship, nor do I even like the devil