This small program behaves differently due to only one compilation flag in GCC and depending on compiler version for MS Visual C++:

#include <iostream>
int main(int argc, char* argv[])
{
   // how many times ???
   // how many times will this line be put out???/
   for(int j=0; j<10; j++)
       std::cout <<"Hello World!"<< std::endl;
 
   return 0;
}
Hint: try next two commands for compiling it with GCC 4.x:
1.       g++ test.cpp -o test
2.       g++ test.cpp -trigraphs -o test
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s