Original Post
How do i change the compiler of C++ 11 in VS12 to codeblocks compiler
#include <iostream>
using namespace std;
int main()
{
//Chapter 2 : Additon code
//Chapter 2 : Divisional code
int first, second;
cout << "Dividing 28 by 14." << endl;
first = 28;
second = 14;
cout << "Quotient " << first / second << endl;
cout << "Remainder " << first % second << endl;
cout << "Dividing 32 by 6." << endl;
first = 32;
second = 6;
cout << "Quotient " << first / second << endl;
cout << "Remainder " << first % second << endl;
//chapter 2 : char
cout << "Char " << first / second << endl;
char ch;
ch = 'a';
cout << ch << endl;
char c;
c = '\0';
cout << c << endl;
cout << "hif" << endl;
return 0;
}
stytem( "pause" );
std::cout << "press the enter key to continue" << std::endl;
char c;
std::cin >> c;
system("pause");
void pause_console(char const* message)
{
std::cout << message << std::flush;
std::cin.ignore(std::numeric_limits< std::streamsize >::max(), '\n');
}
I really can't recommend against
system("pause");
enough. Especially when you can have highly portable functions available to you in the standard library.
I prefer to use something like:
void pause_console(char const* message)
{
std::cout << message << std::flush;
std::cin.ignore(std::numeric_limits< std::streamsize >::max(), '\n');
}
Benefits? Independent of IDE in use and is platform independent.
Incidentally, the MSVC compiler in VS2012 is perfectly fine. I would recommend sticking with it on the Windows platform. In fact, the only reason I use g++ on Windows is to experiment with variadic templates among other things that VS doesn't yet support. For the simple stuff, though, don't sweat over compiler differences too much. Your results should be the same regardless.
that supports variadic templates and few more nice features of C++11.
[quote name='noizex' timestamp='1354041989' post='5004608']
that supports variadic templates and few more nice features of C++11.
The official Update 1 was just released yesterday. It's not a preview anymore.
[quote name='BigDaveDev' timestamp='1353870914' post='5003980']
-snip -
std::vector< int > my_ints = {1, 2, 3, 4, 5}; // won't compile
// Neither will this...
for(auto i: {1, 2, 3, 4, 5})
{
std::cout << i << ' ';
}
This topic has been locked by a moderator. New replies are not allowed.
GameDev.net uses cookies to ensure you have the best experience on our platform. Learn more