Creative Commons License Foxbond's Repo

/** (c) 2012 Michał (Foxbond) Chraniuk */
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
 	int lenght = 11;
 	char wyraz[12] = "informatyka";
 	char wyraz2[12] = "***********";
 	char litera;
 	int lvl = 0;
 	int count = 0;
 	int countcheck = 0;
 	bool ingame = true;
 	bool charexists = false;
 	
 	do {
	   
 	   if (lvl == 0){
 	   	  //dla niczego (tyle \n ile wys. ma nasz wisielec
 	   	  cout << "\n";
	   }
 	   if (lvl == 1){
 	   	  //poz1
 	   	  cout << "1\n";
	   }
	   if (lvl == 2){
 	   	  //2
 	   	  cout << "2\n";
	   }
	   if (lvl == 3){
 	   	  //3
 	   	  cout << "3\n";
	   }
	   if (lvl == 4){
 	   	  //4
 	   	  cout << "4\n";
	   }
	   if (lvl == 5){
 	   	  //5 ostatni -> jak chccesz wiecej to dodaj analogicznie do reszty
 	   	  cout << "5\n";
 	   	  ingame = false;
	   }
 	   
 	   cout << "\n"<<wyraz2;
 	   cout << "\nPodaj litere: ";
 	   cin >> litera;
 	   system("cls");
 	   countcheck = count;
 	   for (int i=0;i<lenght;i++){
	   	   if (litera == wyraz2[i]){
 	  		  charexists = true;
		   }
	   	   
	   }
	   
	   if (!charexists){
	   
 	   	for (int i=0;i<lenght;i++){
 	   		if (litera == wyraz[i]){
 	  		  wyraz2[i] = litera;
	   	   	  count++;
		    } 
	    }
 	   
	   }
 	   
 	   if (countcheck == count || charexists) {
		  lvl++;
		  charexists = false;
 	   }
 	   
 	   
 	   if (count >= lenght){
  		  cout << "Wygrales!\n";
  		  system("pause");
  		  return 0;
 	   }
 	   
 	   
  	 }while(ingame);
 	
 	cout << "Przegrales!\n";
 	
 	
 	
    system("PAUSE");
    return 0;
}

> Back