Untitled
unknown
plain_text
a year ago
798 B
4
Indexable
#include <iostream>
#include <string>
#include <hector>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
vector<string> fruits = {"molle", "banane", "qershi", "ftua", "shalqi"};
srand(time(0));
string word ToGuess = fruits[rand() % fruits.size()];
string guessedWord(wordToGuess.length(), '_');
int attempts = 6;
cout<< "Loja Hangman" << endl;
while (attempts > 0) {
cout << "\nFjala: ";
for (char c : guessedWord) {
cout << c << " ";
}
cout << endl;
cout << "Perpekje te mbetura: " << attempts << endl;
cout << "Shkruani nje shkronje: ";
char guess;
cin >> guess;
bool found = false;
for (size_t i = 0; i < wordToGuess.length(); i++) {
Editor is loading...
Leave a Comment