#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <time.h>
#define MAX_WORD_LENGTH 100
void displayWord(char *word, int *guessed) {
for (int i
= 0; i
< strlen(word
); i
++) { if (guessed[i]) {
} else {
}
}
}
int main() {
char *words[] = {"программирование", "компьютер", "информация", "алгоритм", "инженер","Татьяна Александровна"};
int numWords = sizeof(words) / sizeof(words[0]);
char word[MAX_WORD_LENGTH];
int guessed[MAX_WORD_LENGTH] = {0};
int wordLength
= strlen(word
); int attempts = wordLength + 5;
int correctGuesses = 0;
printf("Добро пожаловать в игру 'Поле Чудес'!\n"); printf("Угадайте слово. У вас есть %d попыток.\n", attempts
);
while (attempts > 0 && correctGuesses < wordLength) {
displayWord(word, guessed);
char guess;
int found = 0;
for (int i = 0; i < wordLength; i++) {
if (word[i] == guess && !guessed[i]) {
guessed[i] = 1;
correctGuesses++;
found = 1;
}
}
if (found) {
} else {
printf("Неправильно. Попробуйте снова.\n"); attempts--;
}
printf("Осталось попыток: %d\n", attempts
); }
if (correctGuesses == wordLength) {
printf("Поздравляем! Вы угадали слово: %s\n", word
); } else {
printf("К сожалению, вы не угадали слово. Это было: %s\n", word
); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8bG9jYWxlLmg+CiNpbmNsdWRlIDx0aW1lLmg+CgojZGVmaW5lIE1BWF9XT1JEX0xFTkdUSCAxMDAKCnZvaWQgZGlzcGxheVdvcmQoY2hhciAqd29yZCwgaW50ICpndWVzc2VkKSB7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IHN0cmxlbih3b3JkKTsgaSsrKSB7CiAgICAgICAgaWYgKGd1ZXNzZWRbaV0pIHsKICAgICAgICAgICAgcHJpbnRmKCIlYyAiLCB3b3JkW2ldKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwcmludGYoIl8gIik7CiAgICAgICAgfQogIC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gIHByaW50Zigi0JLQstC10LTQuNGC0LUg0LHRg9C60LLRgzogIik7CiAgICAgICAgY2hhciBndWVzczsKICAgICAgICBzY2FuZigiICVjIiwgJmd1ZXNzKTsKCiAgICAgICAgaW50IGZvdW5kID0gMDsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHdvcmRMZW5ndGg7IGkrKykgewogICAgICAgICAgICBpZiAod29yZFtpXSA9PSBndWVzcyAmJiAhZ3Vlc3NlZFtpXSkgewogICAgICAgICAgICAgICAgZ3Vlc3NlZFtpXSA9IDE7CiAgICAgICAgICAgICAgICBjb3JyZWN0R3Vlc3NlcysrOwogICAgICAgICAgICAgICAgZm91bmQgPSAxOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoZm91bmQpIHsKICAgICAgICAgICAgcHJpbnRmKCLQn9GA0LDQstC40LvRjNC90L4hXG4iKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwcmludGYoItCd0LXQv9GA0LDQstC40LvRjNC90L4uINCf0L7Qv9GA0L7QsdGD0LnRgtC1INGB0L3QvtCy0LAuXG4iKTsKICAgICAgICAgICAgYXR0ZW1wdHMtLTsKICAgICAgICB9CgogICAgICAgIHByaW50Zigi0J7RgdGC0LDQu9C+0YHRjCDQv9C+0L/Ri9GC0L7QujogJWRcbiIsIGF0dGVtcHRzKTsKICAgIH0KCiAgICBpZiAoY29ycmVjdEd1ZXNzZXMgPT0gd29yZExlbmd0aCkgewogICAgICAgIHByaW50Zigi0J/QvtC30LTRgNCw0LLQu9GP0LXQvCEg0JLRiyDRg9Cz0LDQtNCw0LvQuCDRgdC70L7QstC+OiAlc1xuIiwgd29yZCk7CiAgICB9IGVsc2UgewogICAgICAgIHByaW50Zigi0Jog0YHQvtC20LDQu9C10L3QuNGOLCDQstGLINC90LUg0YPQs9Cw0LTQsNC70Lgg0YHQu9C+0LLQvi4g0K3RgtC+INCx0YvQu9C+OiAlc1xuIiwgd29yZCk7CiAgICB9CgogICAgcmV0dXJuIDA7Cn0=