Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <string>
- #include <cstring>
- #include <ctime>
- using namespace std;
- typedef void(*funkcija)();
- struct igralec
- {
- string ime;
- int vpisna_stevilka;
- string ugibane_besede;
- string ugibane_crke;
- int potreben_cas;
- }Igralec_1,Igralec_2,Igralec_3,Igralec_4,Igralec_5;
- void scenarij_0()
- {
- }
- void scenarij_1()
- {
- cout <<
- "____ \n";
- }
- void scenarij_2()
- {
- cout <<
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_3()
- {
- cout <<
- " ________ \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_4()
- {
- cout <<
- " ________ \n"
- " | | \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_5()
- {
- cout <<
- " ________ \n"
- " | | \n"
- " | (_) \n"
- " | \n"
- " | \n"
- " | \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_6()
- {
- cout <<
- " ________ \n"
- " | | \n"
- " | (_) \n"
- " | | \n"
- " | | \n"
- " | \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_7()
- {
- cout <<
- " ________ \n"
- " | | \n"
- " | (_) \n"
- " | \\| \n"
- " | | \n"
- " | \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_8()
- {
- cout <<
- " ________ \n"
- " | | \n"
- " | (_) \n"
- " | \\|/ \n"
- " | | \n"
- " | \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_9()
- {
- cout <<
- " ________ \n"
- " | | \n"
- " | (_) \n"
- " | \\|/ \n"
- " | | \n"
- " | / \n"
- " | \n"
- "_|___ \n";
- }
- void scenarij_10()
- {
- cout <<
- " ________ \n"
- " | | \n"
- " | (_) \n"
- " | \\|/ \n"
- " | | \n"
- " | / \\ \n"
- " | \n"
- "_|___ \n KONEC IGRE!";
- }
- bool preveri(string geslo, char poiskus, string & resitev)
- {
- bool ok = 0;
- for (int i = 0; i<geslo.length(); i++)
- {
- if (poiskus == geslo[i])
- {
- resitev[i] = poiskus;
- ok = 1;
- }
- }
- if (ok == 1)
- return 1;
- else
- return 0;
- }
- bool poizkusi(string geslo)
- {
- char poiskus;
- int i = 0;
- char narobe[10];
- string resitev;
- resitev.resize(geslo.length(), '_');
- cout << "Resitev: " << resitev << endl;
- funkcija scenarij[] = {
- scenarij_0,
- scenarij_1,
- scenarij_2,
- scenarij_3,
- scenarij_4,
- scenarij_5,
- scenarij_6,
- scenarij_7,
- scenarij_8,
- scenarij_9,
- scenarij_10
- };
- do
- {
- cout << "Vnesi crko: ";
- cin >> poiskus;
- if (preveri(geslo, poiskus, resitev) == 1)
- {
- system("cls");
- cout << "PRAVILNO!" << endl;
- scenarij[i]();
- cout << "Resitev: " << resitev << endl;
- cout << "Napacne crke: ";
- for (int j = 0; j<10 && narobe[j] != 0; j++)
- cout << narobe[j] << " ";
- cout << endl;
- if (geslo == resitev)
- return 1;
- }
- else
- {
- narobe[i] = poiskus;
- i++;
- system("cls");
- cout << "NAROBE" << endl;
- scenarij[i]();
- cout << "Resitev: " << resitev << endl;
- cout << "Napacne crke: ";
- for (int j = 0; j<10 && narobe[j] != 0; j++)
- cout << narobe[j] << " ";
- cout << endl;
- }
- } while (i<10);
- return 0;
- }
- int main()
- {
- srand(time(NULL));
- string gesla[100] = {
- "abeceda"
- "uran",
- "postelja",
- "orhideja",
- "kljucavnica",
- "okvir",
- "miza",
- "okras",
- "kolo",
- "stol",
- "steklenica",
- "barva",
- "stojalo",
- "skatla",
- "ventilator",
- "obutev",
- "pokrov",
- "hranilnik",
- "nit",
- "noht",
- "zapestnica",
- "ogrinjalo",
- "oko",
- "mreza",
- "medalja",
- "drevo",
- "svecnik",
- "kamen",
- "lucka",
- "sponka",
- "prostor",
- "komoda",
- "toaleta",
- "knjiznica",
- "susilnik",
- "likalnik",
- "trenirka",
- "drevored",
- "plakat",
- "svecanost",
- "radiator",
- "stikalo",
- "vticnica",
- "prevleka",
- "kartoteka",
- "jopic",
- "onesposobiti",
- "brivnik",
- "paralizator",
- "svetilka",
- "vlomilec",
- "racunalnik",
- "omrezje",
- "posnetek",
- "premozenje",
- "kriminalka",
- "televizija",
- "prodajalka",
- "tehnologija",
- "sprehod",
- "varovanje",
- "posel",
- "diplomat",
- "imuniteta",
- "zuzelka",
- "sporocilo",
- "datoteka",
- "oskrbnik",
- "kamera",
- "casopis",
- "klient",
- "kompresor",
- "model",
- "eksplozija",
- "komar",
- "skodelica",
- "kravata",
- "nadstropje",
- "prizorisce",
- "predsednik",
- "komunikacija",
- "gorivo",
- "postrv",
- "baterija",
- "naslonjalo",
- "podatek",
- "tetovaza",
- "restavracija",
- "opozorilo",
- "kilometer",
- "vozilo",
- "odbor",
- "pisarna",
- "virus",
- "policist",
- "popravilo",
- "pomanjkanje",
- "oderuh",
- "prtljaznik",
- "menjalnik"
- };
- int indeks = rand() % 100 + 0;
- if (poizkusi(gesla[indeks]) == 1)
- cout << endl << "BRAVO" << endl;
- else
- cout << endl << "OJOJ" << endl;
- {
- clock_t t;
- t = clock();
- t = clock() - t;
- cout << "Vas cas je: " << t, ((float)t) / CLOCKS_PER_SEC) << "s." << endl;
- return 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement