c++11

devcpp增加对c++11的支持

工具→编译选项

如图,增加c++11支持

c++11

 

c++11 random头文件对随机数的支持

c++11
// random_device example
#include <iostream>
#include <random>

int main ()
{
  std::random_device rd;

  std::cout << "default random_device characteristics:" << std::endl;
  std::cout << "minimum: " << rd.min() << std::endl;
  std::cout << "maximum: " << rd.max() << std::endl;
  std::cout << "entropy: " << rd.entropy() << std::endl;
  std::cout << "a random number: " << rd() << std::endl;

  return 0;
}
c++11

 

// random_device example
#include <iostream>
#include <random>

int main ()
{
  std::random_device rd;

  std::cout << "default random_device characteristics:" << std::endl;
  std::cout << "minimum: " << rd.min() << std::endl;
  std::cout << "maximum: " << rd.max() << std::endl;
  std::cout << "entropy: " << rd.entropy() << std::endl;
  std::cout << "a random number: " << rd() << std::endl;

  return 0;
}

c++11,布布扣,bubuko.com

c++11

上一篇:jquery中$.get()提交和$.post()提交有区别吗?


下一篇:::在c++中的应用