Given such a task.
The program "conceives" a number in the range from 1 to 10 and prompts the user to guess the number of 5 attempts.
Program:
#include <vcl.h> #include <iostream.h> #include <conio.h> #include <stdlib.h> char *Rus(const char *text); { srand(time(0)); int a; // задуманное число int b; // число которое вводит пользователь int c = 5; // число попыток a = rand() % 10; do { c--; cout << Rus(" Введите число: "); cin >> b; } while (c != 0 || b != a) if (c == 0 && b != a) cout << Rus(" у вас не осталось попытки, вы проиграли "); else if (a == b) cout << Rus(" вы победили "); getch(); } char bufRus[256]; char *Rus(const char *text) { CharToOem(text, bufRus); return bufRus; } }
But the program gives errors. Help me please.