Algo Coding
Algo Coding
NIM :5243351008
CODINGAN:
#include <iostream>
int main() {
int userGuess;
srand(static_cast<unsigned int>(time(0)));
cout << "Anda memiliki " << MAX_ATTEMPTS << " kali kesempatan untuk menebak nomor." <<
endl;
cout << "Tebakan Anda (Coba ke-" << attempt << "): ";
if (userGuess == SECRET_NUMBER) {
isCorrect = true;
} else {
cout << "Tebakan Anda salah. ";
} else {
if (isCorrect) {
cout << "Selamat! Anda berhasil menebak nomor " << SECRET_NUMBER << "!" << endl;
} else {
cout << "Nomor yang benar adalah " << SECRET_NUMBER << "." << endl;
return 0;
TAMPILAN OUTPUTNYA: