已关闭

Creating a quiz with animal names in C++ ONLY. - Repost - 12/10/2016 19:02 EDT

In this game, a player is asked by computer to type in several animal names such as "dog," "cat," etc., in the beginning of the game session. There is no limit to the count of the names but these names must be space delimited. When entering a return key without typing anything (i.e., empty line), this process of input cycle ends. So, use getline() to realize this input logic - the concrete process to tokenize each name can be reproduced from lectured coding demonstration.

The computer will pick up 1 to 3 names from those entered by the player. They are shuffled to produce a random word. The player will be asked to identify the names, given a hint of how many animals in that word. The player needs to type in names (or a name if asked one). Typing "?" will show the name list, and typing "quit" will end the game.

When succeeding to answer in two consecutive rounds, the computer's challenge becomes harder by striking out a character one by one. The position to strike out is chosen at random. So, succeeding 4 consecutive times, the random word has two strikes out shown by underscore "_" characters. On the other hand, failing to answer in two consecutive rounds, the computer's challenge becomes easier by reducing the count of strikes out. The sample session follows.

Enter at least five animal names, e.g., cat, dog, etc...

> dog cat

> snake zebra

> tiger

>

1: dog

2: cat

3: snake

4: zebra

5: tiger

What are 2 animals in "gbzeoard" ? zebra dog

Yes!

What are 2 animals in "dgaoct" ? dog cat

Yes!

Succeeded two consecutive times, challenge goes up!

What are 1 animal in "ezar_" ? zebra

Yes!

What are 1 animal in "do_" ? dog

Yes!

Succeeded two consecutive times, challenge goes up!

What are 1 animal in "z__ae" ? zebra

Yes!

What are 2 animals in "okadg__n" ? dog snake

Yes!

Succeeded two consecutive times, challenge goes up!

What are 1 animal in "_ke__" ? snake

Yes!

What are 2 animals in "e_d_g_ir" ? tiger dog

Yes!

Succeeded two consecutive times, challenge goes up!

What are 3 animals in "et_s__era_ngk" ? cat zebra snake

Nope!

What are 1 animal in "__i__" ? dog snake

Your number of input is incorrect. Enter again: dog

Nope!

Missed two consecutive times, challenge goes down!

What are 1 animal in "___" ? cat

Yes!

What are 3 animals in "koge__zsaa_db" ? ?

1: dog

2: cat

3: snake

4: zebra

5: tiger

Your number of input is incorrect. Enter again: quit

Bye...

To realize various randomized effects in the game, use random_shuffle() or shuffle() algorithm function wisely to reduce the amount of coding. You can find many examples on the Web -- see here ([url removed, login to view]) for instance.

技能: C++编程, Javascript, Linux, MySQL, Python

查看更多: sample stack program, programming quiz, facebook quiz help creating, creating quiz php, creating multiple choice quiz, php creating quiz, company names creating design

About the Employer:
( 1 review ) bronx, United States

项目ID: #11772571

7名威客为此工作的平均竞标价是$44

hbxfnzwpf

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 6 years. My work is online game developing, and mainly focus on server side, using c++ under linux environ 更多

$100 USD 在2天内
(74条评论)
6.4
utkarshkatiyar19

A proposal has not yet been provided

$70 USD 在3天内
(87条评论)
5.7
AlexeyProkopnev

Hired by the Employer

$20USD 在1天里
(4条评论)
2.2
syed889

HI ! Well I offered you a very competitive price. I expect to finish project much before deadline. looking forward to hear from you. syed

$25 USD 在3天内
(0条评论)
0.0
lamia00

What makes me the best candidate for this job is, well, C++ is my favorite language to use and I would love to have my knowledge be of some use to someone. I hope you will consider me for this job. Thank You.

$20 USD 在4天内
(0条评论)
0.0
renyuzhi

There are 2 person in our team: my husband and I. Both of us work as software engineer. And we will finish your project in time.

$50 USD 在10天内
(0条评论)
0.0
vanewow

Sounds easy enough. Just one question: When you get it correct 2 times it will hide 1 character , so is there a limit as to how many characters are hidden in a string or can it go on till all characters are hidden 更多

$20 USD 在7天内
(0条评论)
0.0