Jump to content

Search the Community

Showing results for tags 'x si 0'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Informatii generale
    • Anunturi importante
    • Bine ai venit
    • Proiecte RST
  • Sectiunea tehnica
    • Exploituri
    • Challenges (CTF)
    • Bug Bounty
    • Programare
    • Securitate web
    • Reverse engineering & exploit development
    • Mobile security
    • Sisteme de operare si discutii hardware
    • Electronica
    • Wireless Pentesting
    • Black SEO & monetizare
  • Tutoriale
    • Tutoriale in romana
    • Tutoriale in engleza
    • Tutoriale video
  • Programe
    • Programe hacking
    • Programe securitate
    • Programe utile
    • Free stuff
  • Discutii generale
    • RST Market
    • Off-topic
    • Discutii incepatori
    • Stiri securitate
    • Linkuri
    • Cosul de gunoi
  • Club Test's Topics
  • Clubul saraciei absolute's Topics
  • Chernobyl Hackers's Topics
  • Programming & Fun's Jokes / Funny pictures (programming related!)
  • Programming & Fun's Programming
  • Programming & Fun's Programming challenges
  • Bani pă net's Topics
  • Cumparaturi online's Topics
  • Web Development's Forum
  • 3D Print's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Yahoo


Jabber


Skype


Location


Interests


Occupation


Interests


Biography


Location

Found 1 result

  1. O sa postez in cele ce urmeaza un mic joc, care e foarte bun pentru cei care abia au inceput sa descopere C++. #include <iostream> #include <vector> //Simple Display void Display(std::vector<char> const &grid){ //Creez un grid basic std::cout << " " << 1 << " " << 2 << " " << 3 << "\n"; for(int a = 0; a < 9; a++){ if(a == 0) std::cout << "A "; if(a == 3) std::cout << "\nB "; if(a == 6) std::cout << "\nC "; //displaying grid. std::cout << " " << grid[a] << " "; } std::cout << "\n\n"; } //Returneaza true daca grid-ul e deja folosit. bool Used(int const& position, std::vector<char> const& grid){ if(grid[position] == '-') return false; else return true; } void Turn(std::vector<char> &grid, char player){ int row = 0; char column = 0; int position = 0; bool check = true; std::cout <<"\n" << player << ": Jucati !. \n"; while(check == true){ std::cout << "Row(1,2,3): "; std::cin >> row; std::cout << player << ": Column(A,B,C): "; std::cin >> column; position = 3*(column-'A')+(row-1); if(!Used(position,grid)){ check = false; } else{ std::cout << "Pozitie deja folosita. Incearca din nou. \n"; } } grid[position] = player; std::cout << "\n\n"; } bool Win(std::vector<char> const& grid, char player){ for(int a = 0; a < 3; a++){ if(grid[a] == player && grid[a+3] == player && grid[a+6] == player){ return true; } if(grid[3*a] == player && grid[3*a+1] == player && grid[3*a+2] == player){ return true; } } if(grid[0] == player && grid[4] == player && grid[8] == player){ return true; } if(grid[2] == player && grid[4] == player && grid[6] == player){ return true; } return false; } int main(){ std::vector<char>grid(9,'-'); while(true){ Display(grid); Turn(grid, 'X'); if(Win(grid, 'X')){ Display(grid); std::cout << "\n X este castigator. Are o bere! \n"; break; } Display(grid); Turn(grid,'O'); if(Win(grid, 'O')){ Display(grid); std::cout << "\n 0 este castigator. Are o bere! \n"; break; } } } Enjoy.
×
×
  • Create New...