-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutil.cpp
More file actions
46 lines (34 loc) · 770 Bytes
/
util.cpp
File metadata and controls
46 lines (34 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "util.h"
#include <stdexcept>
#include <iomanip>
#include<iostream>
/**
* Constructor for the point struct, so that an easy way to construct it with the right values exists.
* @param x x ordinate
* @param y y ordinate
*/
Point::Point(double x, double y) : x(x), y(y)
{}
Point::Point()
{}
void clearScreen()
{
if (system("CLS"))
{
system("clear");
}
}
void sleep(double seconds){
int msleep = static_cast<int>(seconds *1000);
std::this_thread::sleep_for(std::chrono::milliseconds(msleep));
}
void PressEnterToContinue()
{
PressEnterToContinue(std::cout,std::cin);
}
void PressEnterToContinue(std::ostream &os,std::istream &is)
{
os << "\nPress Enter to Continue..";
os.flush();
is.ignore(1000,'\n');
}