<commit_before>#include "Card.h"
#include "Deck.h"

int main() {

	// Instantiate deck of cards

	Deck *d = new Deck();

	// Pick a card from the deck
	string noCards;

	// 1 or 2 character number
	const regex reg("\\d{1,2}");

	while (true) {

		cout << "How many cards (1-52): " << flush;

		getline(cin, noCards);

		// Validate user input
		const bool result = regex_match(noCards, reg);

		if (result)
		{
			int iNoCards = atoi(noCards.c_str());
			for (unsigned int i = 0; i < iNoCards; ++i) {
				d->pickCard();
			}
		}
		else
		{
			cout << "Number 1-25 please" << endl;
		}

		cin.clear();

		if (noCards == "0") { break; }

	}

	//cin.get();

	delete d;
<commit_msg>Improved support for user input<commit_after>#include "Card.h"
#include "Deck.h"

bool validEntry(string *nC, unsigned int *iC){
	
	// 1 or 2 character number regex pattern
	const regex reg("\\d{1,2}");

	// Validate user input
	bool valid = regex_match(*nC, reg);

	const string s = *nC;
	*iC = atoi(s.c_str());

	if (*iC > 52) { valid = false; }

	return valid;
}

int main() {

	// Instantiate deck of cards

	Deck *d = new Deck();

	// Pick a card from the deck
	string noCards;
	string *nC = &noCards;

	// integer for valid result
	unsigned int iNoCards;
	unsigned int *iN = &iNoCards;

	while (true) {

		d->getDeck();

		cout << "How many cards (1-52): " << flush;

		getline(cin, *nC);

		if (validEntry(nC, iN))
		{
			for (unsigned int i = 0; i < *iN; ++i) {
				d->pickCard();
			}
		}
		else
		{
			cout << "Number 1-25 please" << endl;
		}

		cin.clear();

		if (noCards == "0") { break; }

	}

	delete d;

{'fraction_non_alphanumeric': 0.1702127659574468, 'fraction_numerical': 0.016270337922403004, 'mean_word_length': 2.718604651162791, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '99029', 'n_tokens_mistral': 725, 'n_tokens_neox': 633, 'n_words': 188}