There is a program, I can not understand what the compiler does not like. In Java, I would do this in 5 minutes. I will forgive forgiveness if I’m frankly stupid somewhere, because I started communicating with C ++ only today. In theory, the main method should call the randomSpeak method.
#include <iostream> #include <locale.h> #include <windows.h> #include <stdlib.h> using namespace std; int main() { setlocale(LC_ALL, "rus"); int i; for (i = 0; i < 20; i++) { cout << "\a" << endl; int randomInt = 0 + rand()%10; //Строка ниже упорно выдаёт ошибку randomSpeak(randomInt); Sleep(1000); } return 0; } void randomSpeak (int s) { if (s == 0) { cout << "0&?!?!?!?" << endl; } if (s == 1) { cout << "1!" << endl; } if (s == 2) { cout << "Винда повисла!" << endl; } if (s == 3) { cout << "3!!!" << endl; } if (s == 4) { cout << "Надо было ставить Linux!" << endl; } if (s == 5) { cout << "5 Microsoft!" << endl; } if (s == 6) { cout << "6 и винда готова!" << endl; } if (s == 7) { cout << "format c:/ is starting..." << endl; } if (s == 8) { cout << "8!!" << endl; } if (s == 9) { cout << "9!!" << endl; } if (s == 10) { cout << "10" << endl; } }