@phoopio/

Assignment 13: Random Number and Grid Writer

C++

No description

fork
loading
Files
  • main.cpp
  • GridWriter.txt
  • RandomNumberGuesser.cpp
  • RandomNumberGuesser.h
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
48
#include "NumberGuesser.h"
#include "RandomNumberGuesser.h"
#include <iostream>

using namespace std;

int main() {
	NumberGuesser *bng = new RandomNumberGuesser(1, 100);

	// 	for (int i = 0; i < 5; i++) {
	// 		cout << bng->getCurrentGuess() << endl;
	// 		bng->higher();
	// 		cout << bng->getCurrentGuess() << endl << endl;
	// 	}

	// 	NumberGuesser *ng = new NumberGuesser(1, 100);

	// 	cout << ng->getCurrentGuess() << endl;

	NumberGuesser *rng = new RandomNumberGuesser(1, 100);

	// picks a random number between 1 and 10, let’s say it is 3, and outputs
	// it.

	cout << rng->getCurrentGuess() << endl;

	// this line prints out 3 again, because it is still the current guess

	// this line changes low to 4 because we now know the number is higher than
	// 3.

	// high remains unchanged at 10.

	rng->higher();

	// this line picks a random number between 4 and 10 and prints it out,

	// let’s say it is 9

	cout << rng->getCurrentGuess() << endl;

	// this line prints out 9 again, because it is still the current guess

	cout << rng->getCurrentGuess() << endl;

	// Make careful note of how the word “virtual” is used in NumberGuesser.h !
}