proj 5 soln.cpp

proj 5 soln.cpp - // Project 5 #define...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // Project 5 #define _CRT_SECURE_NO_DEPRECATE #include <iostream> #include <fstream> #include <cstring> #include <cctype> #include <cstdlib> #include <ctime> using namespace std; const int MINWORDLEN = 4; const int MAXWORDLEN = 6; const int MAXPROBELEN = 200; const int MAXWORDS = 8000; void fillWords(char words[MAXWORDLEN+1], int maxwords, int& nwords); int playOneRound(char words[MAXWORDLEN+1], int num, int wordnum); bool contains(const char words[MAXWORDLEN+1], int num, const char str); int countMatches(const char s1, const char s2); int randInt(int limit); int main() { // Initialize random number generator srand(time(0)); // Get word list char wordList[MAXWORDS][MAXWORDLEN+1]; int nWords; fillWords(wordList, MAXWORDS, nWords); if (nWords < 1) { cout << "No words! Can't play the game." << endl; return 1; } cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); cout << "How many rounds do you want to play? "; int nRounds; cin >> nRounds; cin.ignore(100000, '\n'); int totalProbes = 0; int minProbes; int maxProbes; // Play rounds for (int round = 1; round <= nRounds; round++) { cout << "Round " << round << endl; // Select random word as secret word...
View Full Document

This note was uploaded on 02/02/2011 for the course CS 31 taught by Professor Melkanoff during the Spring '00 term at UCLA.

Page1 / 4

proj 5 soln.cpp - // Project 5 #define...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online