نص السؤال هو كالتالي:

Develop a word-guessing game, like Hangman. The game will have two users, Person A and Person B. While B isn’t looking, Person A will input a word up to a specified appropriate maximum length. The word that has been input should contain only letters — no punctuation, numerals or other special characters. If the word is invalid for some reason, the program should require A to input the word again until a valid input is received. The program should not be sensitive to case when receiving input and making comparisons. Once the word has been successfully input, the program can clear the screen by printing a large number of blank lines. 

Person B then has up to 10 turns in order to guess the word and win the game. At the start of each turn, the program will display a series of underscores on the screen, one for each letter in the word. Initially, no letters will have been guessed, so each letter in the word will be printed only as an underscore. 

During each turn, B can either guess a letter or solve the puzzle. If they choose to solve the puzzle at any point, correctly guessing the word will lead to them winning the game. However, if they solve the puzzle incorrectly, they will immediately lose and the game will end. They will also lose if they run out of turns. 

If B chooses to guess a letter during their turn, the program will inform them of how many of this letter occur within the secret word. The program will then begin their next turn, if they still have turns remaining. The program should warn B when they are on their last (10th) turn. 

If B runs out of turns without guessing the word, then they will have lost and the program will display what the word was and then exit. 

Hint: Spend plenty of time thinking about and making notes on the design of the program before you begin! In particular, you will need to store not just the word being guessed but the status of each letter within that word (i.e., guessed/unknown). You may wish to do this with two arrays, or otherwise using a struct. 

Please note that there are no extra marks for the drawing of Hangman itself etc.

 

وبالمرفقات تجدون ملفات تحوي نص السؤال والكود كاملا, باستخدام c++

 

تمرين c++

تمارين c++

اسئلة اختبارات c++

ابحث عن مسائل برمجة سي بلس بلس | C++ programming بالانجليزي

هل أعجبك المحتوى؟

محتاج مساعدة؟ تواصل مع مدرس اونلاين الان!

التعليقات
لا يوجد تعليقات
لاضافة سؤال او تعليق على المشاركة يتوجب عليك تسجيل الدخول
تسجيل الدخول