79220685

Date: 2024-11-24 17:26:30
Score: 0.5
Natty:
Report link
#include <iostream>
#include <chrono>
#include <thread>
#include <algorithm>
using namespace std::chrono;
// c++ makes me go crazy 
// this is basically a stopwatch when you press enter it will stop the  
//time
//hopefully this can give you kind of a grasp of what you can do with 
//chrono

int main()
{
auto start = std::chrono::high_resolution_clock::now();
std::this_thread::sleep_for(0s);
std::cout << "press enter to stop time \n";
std::cin.get();
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<float> duration = end - start;
std::cout << "your time was " << duration.count() << "s " << std::endl;
return 0;
} 
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user28462484