66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* Champlain College SDEV-240-81A
|
|
*
|
|
* C++ Final Project (first semester) - Coding Component (2020/05/02)
|
|
*
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
*
|
|
* This is a demonstration in C++ of a game called
|
|
* Game of life created by John Horton Conway in 1970
|
|
* https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
|
|
*
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
*
|
|
* Written by Llewellyn van der Merwe <llewellyn.vandermerw@mymail.champlain.edu>, April 2020
|
|
* Copyright (C) 2020. All Rights Reserved
|
|
* License GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
*
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
#ifndef GOL_GETINPUT_H
|
|
#define GOL_GETINPUT_H
|
|
|
|
// internal classes
|
|
#include "Message.h"
|
|
// libraries
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
|
|
namespace GOL {
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* I am trying out namespace just to see how it works :) any input would be great!
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
class GetInput {
|
|
private:
|
|
string input;
|
|
public:
|
|
// constructor
|
|
GetInput(string question = "") {
|
|
// set message
|
|
Message ask(question);
|
|
// print question
|
|
ask.print(0);
|
|
// get the input requested
|
|
cin >> input;
|
|
}
|
|
|
|
GetInput(Message &question) {
|
|
// print question
|
|
question.print(0);
|
|
// get the input requested
|
|
cin >> input;
|
|
}
|
|
|
|
// destructor
|
|
~GetInput() {}
|
|
|
|
// get method
|
|
string get() const;
|
|
};
|
|
}
|
|
|
|
#endif //GOL_GETINPUT_H
|