Skip to content

Instantly share code, notes, and snippets.

@jeromew21
Last active July 30, 2019 22:09
Show Gist options
  • Save jeromew21/c09d876c294ab1c363fc47c70e188008 to your computer and use it in GitHub Desktop.
Save jeromew21/c09d876c294ab1c363fc47c70e188008 to your computer and use it in GitHub Desktop.
c++ cheatsheet
#include <fstream>
//STUFF
std::ofstream fileout;
fileout.open("filename.txt", std::ios_base::app);
fileout << "hello world";
//STUFF
#include <chrono>
/*
* ...
*/
auto start = std::chrono::high_resolution_clock::now();
/*
* do stuff
*/
auto stop = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); //or milliseconds
double duration_count = duration.count();
std::string input(std::string const &message) {
std::string result;
std::cout << message;
getline(std::cin, result);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment