-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (33 loc) · 989 Bytes
/
main.cpp
File metadata and controls
44 lines (33 loc) · 989 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 "CDegrees.h"
#include <cstdlib> // For rand() and srand()
#include <ctime> // For time()
#include <fstream> // For file input/output
#include <iostream>
using namespace std;
// Function to read the seed value from "seed.txt"
int readSeedFromFile(const char* filename) {
ifstream file(filename);
int seed = 0;
if (file.is_open()) {
file >> seed; // Read the seed from the file
file.close();
} else {
// If the file could not be opened, use the current time as a seed
cout << "Could not open seed file. Using current time as seed." << endl;
seed = static_cast<int>(time(nullptr));
}
return seed;
}
int main()
{
int seed = readSeedFromFile("E:\\Projects\\Degrees of Hell\\seed.txt");
srand(seed);
CDegrees game;
game.ReadSpaces("degrees.txt");
game.AddPlayer("Vyvyan");
game.AddPlayer("Rick");
game.AddPlayer("Neil");
game.AddPlayer("Mike");
game.Run();
return 0;
}