-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (34 loc) · 874 Bytes
/
main.cpp
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
43
44
45
46
47
/// @file main.cpp
/// @author Chris Catechis
/// @date 2/6/2022
/// @brief This program tests the knightType class.
#include <iostream>
#include <cstdlib>
#include "knightType.hpp"
int main() {
knightType* tour = NULL;
int dim;
int r, c;
char yesOrNo;
do
{
std::cout << "Enter board dimension: ";
std::cin >> dim;
tour = new knightType(dim);
tour->outputTour();
std::cout << "Enter initial knight position: ";
std::cin >> r >> c;
if (tour->knightTour(r - 1, c - 1))
{
std::cout << "Knight FTW" << std::endl;
tour->outputTour();
}
delete tour;
tour = NULL;
std::cout << "Another go? ";
std::cin >> yesOrNo;
std::cout << '\n';
}
while (std::tolower(yesOrNo) == 'y');
return 0;
}