Friday, May 27, 2011

Exercise of i++ vs ++i

exercise:
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int i;

cout << "Test on i++ \n";
i = 0;
cout << i++ << "\n\n";

while(i++ <= 10){
cout << i << "\n";
}

cout << "\n";
cout << "Test on ++i \n";
i = 0;
cout << ++i << "\n\n";

while(++i <= 10){
cout << i << "\n";
}

system("PAUSE");
return EXIT_SUCCESS;
}


Exercise of i++ vs ++i

No comments:

Post a Comment