Guest User

Untitled

a guest
Mar 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char m[3][3];
  8. for (int i = 0; i < 3; ++i) {
  9. for (int j = 0; j < 3; ++j) {
  10. a[i][j]='-';
  11. }
  12. }
  13. for (int i = 0; i < 3; ++i) {
  14. for (int j = 0; j < 3; ++j) {
  15. cout<<m[i][j]<<" ";
  16. }
  17. cout<<endl;
  18. }
  19.  
  20. int i,j,probel,xC=0;
  21. bool nextX = true;
  22. while(true){
  23. cin>>i>>j;
  24. if(m[i][j]=='-'){
  25. if(nextX){
  26. m[i][j]='x';
  27. nextX=false;
  28. }else{
  29. m[i][j]='o';
  30. nextX=true;
  31. }
  32. }else{
  33. cout<<"Ne chitery!"<<endl;
  34. }
  35.  
  36. probel = 0;
  37. for (int i = 0; i < 3; ++i) {
  38. for (int j = 0; j < 3; ++j) {
  39. cout<<m[i][j]<<" ";
  40. if(m[i][j]=='-')
  41. {
  42. probel++;
  43. }
  44. }
  45. cout<<endl;
  46. }
  47. if(probel==0){
  48. for (int i = 0; i < 3; ++i) {
  49. for (int j = 0; j < 3; ++j) {
  50. a[i][j]='-';
  51. }
  52. }
  53. for (int i = 0; i < 3; ++i) {
  54. for (int j = 0; j < 3; ++j) {
  55. cout<<m[i][j]<<" ";
  56. }
  57. cout<<endl;
  58. }
  59.  
  60.  
  61.  
  62. }
  63. for (int i = 0; i < 3; ++i) {
  64. for (int j = 0; j < 3; ++j) {
  65. if(m[i][j]=='x'){
  66. xC++;
  67. }
  68. }
  69. if(xC==3){
  70. cout<<"Win x";
  71. }
  72. xC=0;
  73. }
  74.  
  75. }
  76.  
  77.  
  78. return 0;
  79. }
Add Comment
Please, Sign In to add comment