From 405a372098606bb7d7287aa27148c6c6f418329f Mon Sep 17 00:00:00 2001 From: boboboba <95755392+boboboba@users.noreply.github.com> Date: Thu, 9 Oct 2025 01:11:42 +0500 Subject: [PATCH 1/2] main.cpp --- main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..b57d650 --- /dev/null +++ b/main.cpp @@ -0,0 +1,20 @@ +#include +#include + +int main() { + std::random_device rd; + unsigned int actualNumber = rd() % 10; + + while (true) { + unsigned int guess; + std::cout << "Guess a number from 0 to 9:" << std::endl; + std::cin >> guess; + if (actualNumber != guess) { + std::cout << "Wrong!" << std::endl; + } + else { + std::cout << "Correct!\n"; + return 0; + } + } +} \ No newline at end of file From 9ba36741328550703f0ab50347e9c93a4c97477f Mon Sep 17 00:00:00 2001 From: boboboba Date: Mon, 22 Dec 2025 00:28:37 +0500 Subject: [PATCH 2/2] cr fix --- main.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index b57d650..3ce6344 100644 --- a/main.cpp +++ b/main.cpp @@ -3,18 +3,17 @@ int main() { std::random_device rd; - unsigned int actualNumber = rd() % 10; + const unsigned int actualNumber = rd() % 10; while (true) { - unsigned int guess; - std::cout << "Guess a number from 0 to 9:" << std::endl; + unsigned int guess{}; + std::cout << "Guess a number from 0 to 9: " << std::endl; std::cin >> guess; if (actualNumber != guess) { - std::cout << "Wrong!" << std::endl; - } - else { std::cout << "Correct!\n"; return 0; } + std::cout << "Wrong!" << std::endl; + } } \ No newline at end of file