Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

for(loops)

Name: Anonymous 2010-10-22 16:52



int main(void) {
  for(int n=0;n!=50;n++)
    cout << "Hello, world no. %d\n" << n << endl;
}

int main(void) {
  for(int n=0;n!=50;++n)
    cout << "Hello, world no. %d\n" << n << endl;
}

int main(void) {
  for(int n=0;n!=50;n=n+1)
    cout << "Hello, world no. %d\n" << n << endl;
}

int main(void) {
  for(int n=0;n!=50;n+=1)
    cout << "Hello, world no. %d\n" << n << endl;
}


The second code runs fastest, followed by the first code, then the third and fourth tied. I though these were logically the same? Why the speed difference.

Name: Anonymous 2010-10-22 16:58

>>2
>(no space)Quote

Back to Fuck off, ``faggot''.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List