{"id":8692,"date":"2022-09-15T01:04:36","date_gmt":"2022-09-14T19:34:36","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/"},"modified":"2022-09-15T01:04:36","modified_gmt":"2022-09-14T19:34:36","slug":"solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/","title":{"rendered":"[Solved] Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-35792091\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"35792091\" data-parentid=\"35790046\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<pre><code>\/\/Play Tic Tac Toe game between user and computer\n\n#include&lt;iostream&gt;\n#include&lt;cstdio&gt;\n#include&lt;stdlib.h&gt;\n#include&lt;time.h&gt;\n\n#define BLANK 5\n\nusing namespace std;\n\n\/***************** Display the Matrix **********************************************\/\n\/\/Display the matrix\nvoid display(int matrix[3][3])\n{\n    for(int i=0;i&lt;3;i++){\n        for(int j=0;j&lt;3;j++)\n            cout&lt;&lt;matrix[i][j]&lt;&lt;\"\\t\";\n        cout&lt;&lt;endl;\n    }\n}\n\n\/************** Chance of WIN Function *****************************************************\/\n\n\/\/Funtion to detect the chance of either for user or system\u0135\nint chance_of_win(int matrix[3][3],int i, int j,int choice){\n\nint result=0;\/\/This variale is used to return the required position\nint other_choice;\/\/This variable is used for other choice of the variable choice\n\nif(choice==0)\n    other_choice=1;\nelse\n    other_choice=0;\n\nint count1=0;\/\/This variable is used to check the count upto 2\n\n    \/\/Diagonal Intelligent\n    if(i==j){\n        for(int k=0;k&lt;3;k++){\n            if(matrix[k][k]==choice)\n                count1++;\n\n            if(count1==2){   \/\/ That means user is going to win and system has to stop that\n                for(int k=0;k&lt;3;k++){\n                    if(matrix[k][k]!=choice &amp;&amp; matrix[k][k]!=other_choice){\n                        int temp=k;\n                        temp=temp*10;\n                        result=temp+k;\n                        return result;\n                    }\n                }\n            }\n        }\/\/for looop ends here\n    }\/\/If Structure ends here\n\ncount1=0; \/\/Reinitilize the count to zero\n\n    \/\/Reverse Diagonal intelligent\n    for(int m=0,n=2;m&lt;3,n&gt;=0;m++,n--){\n        if(matrix[m][n]==choice){\n            count1++;\n        }\n\n        if(count1==2){   \/\/ That means user\/system is going to win reverse diagnally\n        for(int m=0,n=2;m&lt;3,n&gt;=0;m++,n--){\n                if(matrix[m][n]!=choice &amp;&amp; matrix[m][n]!=other_choice){\n                    int temp=m;\n                    temp=temp*10;\n                    result=temp+n;\n                    return result;\n                }\n            }\n        }\/\/End of If structure\n    }\/\/End for loop\n\ncount1=0; \/\/Reinitilize the count to zero\n\n    \/\/Row Intelligent\n    for(int k=0;k&lt;3;k++){\n        if(matrix[i][k]==choice)\n            count1++;\n\n        if(count1==2){   \/\/ That means user\/system is going to win\n            for(int k=0;k&lt;3;k++){\n                if(matrix[i][k]!=choice &amp;&amp; matrix[i][k]!=other_choice){\n                    int temp=i;\n                    temp=temp*10;\/\/for the ith coordiante\n                    result=temp+k;\/\/for the jth cordinate\n                    return result;\/\/Return the required attribute of i and j\n                }\n            }\n        }\n    }\/\/for looop ends here\n\ncount1=0; \/\/Reinitilize the count to zero\n\n    \/\/Column Intelligent\n    for(int k=0;k&lt;3;k++){\n        if(matrix[k][j]==choice)\n            count1++;\n\n        if(count1==2){   \/\/ That means user is going to win and system has to stop that\n            for(int k=0;k&lt;3;k++){\n                if(matrix[k][j]!=choice &amp;&amp; matrix[k][j]!=other_choice){\n                    int temp=k;\n                    temp=temp*10;\/\/for the ith coordinate\n                    result=temp+j;\/\/for the jth coordinate\n                    return result;\/\/Return the required attribute of i and j\n                }\n            }\n        }\n    }\/\/for looop ends here\n\n\nreturn result;\n}\/\/function ends here\n\n\/******************* Check Win Bool Function ******************************************************\/\n\n\/\/This function is used to check the win of the system\/user\nbool checkwin(int matrix[3][3],int i, int j,int choice){\nbool flag=false;\/\/Initialize the chance of win false\nint count1=0;\n    \/\/Diagonal checkwin forward\n    if(i==j){\n        for(int k=0;k&lt;3;k++){\n            if(matrix[k][k]==choice){\n                count1++;\n            }\n            if(matrix[k][k]==BLANK)\n                break;\n        }\n\n        if(count1==3)\/\/Means all diagonal elements are equal\n            flag=true;\n    }\n\n    \/\/If the Diaganoal Forward is same then return\n    if(flag){\n        cout&lt;&lt;\"Diagonal Win\\n\";\n        return flag;\n    }\n\n    \/\/Reverse Diagonal checkwin\n    for(int m=0,n=2;m&lt;3,n&gt;=0;m++,n--){\n        if(matrix[m][n]!=choice || matrix[m][n]==BLANK){\n            flag=false;\/\/If diagonal is not same\n            break;\n        }\n         flag=true;\n    }\n\n    \/\/If the Reverse Diaganoal Forward is same then return\n    if(flag){\n        cout&lt;&lt;\"Reverse Diagonal Win\\n\";\n        return flag;\n    }\n\n    \/\/Row checkwin\n    for(int k=0;k&lt;3;k++){\n        if(matrix[i][k]!=choice || matrix[i][k]==BLANK){\n            flag=false;\/\/ Row is not same\n            break;\n         }\n         flag=true;\n    }\n    \/\/If row is same then return\n    if(flag){\n        cout&lt;&lt;\"Row Win\\n\";\n        return flag;\n    }\n\n    \/\/Column checkwin\n    for(int k=0;k&lt;3;k++){\n        if(matrix[k][j]!=choice || matrix[k][j]==BLANK){\n            flag=false;\/\/Column is not same\n            break;\n         }\n         flag=true;\n    }\n    \/\/If the Column is same then return\n    if(flag){\n        cout&lt;&lt;\"Column Win\\n\";\n        return flag;\n    }\n\n\n    return flag;\/\/return the result false result i.e there is no chance of win\n                \/\/as we have checked all the conditions\n}\n\n\/*************************  Main Function **************************************************\/\n\nint main(){\n\nint matrix[3][3];\n\nbool flag;\nint toss;\nsrand(time(NULL));\ntoss=rand()%2;\n\nif(toss){\n    flag=true;\n    cout&lt;&lt;\"User Wins the Toss\\n\";\n}\nelse{\n    flag=false;\n    cout&lt;&lt;\"System Wins the Toss\\n\";\n}\n\/\/Initialise all the elements of matrix to BLANK i.e. Blank\n\nfor(int i=0;i&lt;3;i++)\n    for(int j=0;j&lt;3;j++)\n        matrix[i][j]=BLANK;\n\ncout&lt;&lt;\"For user the choice is 0\\n\";\ncout&lt;&lt;\"For system the choice is 1\\n\";\n\nint v=1;\/\/Initialise the the variable v , it has the increment till 9 to cover all the elements of the matrix\n\nbool system1=false;\/\/To check the chance of win of system\n\nint user_status=0;\/\/To check the chance of win of user and accordingly system will put his move\nint system_status;\/\/\/\/To check the chance of win of system and accordingly system will put his move\n\nwhile(v&lt;=9){\n\nint i,j;\/\/ \"i\" is for the row coordinate and \"j\" is for the column coordinate\n\n    if(flag==true){\/\/ If user win's the toss\n        cout&lt;&lt;\"Yours turn\\n\";\n        cout&lt;&lt;\"Enter the row coordinate\";\n        cin&gt;&gt;i;\n        i--;\/\/For user convenience i th coordinate\n        cout&lt;&lt;\"Enter the column coordinate\";\n        cin&gt;&gt;j;\n        j--;\/\/For user convenience jth coordinate\n        if(matrix[i][j]==BLANK)\n            matrix[i][j]=0;\/\/Put the user move\n        else{\n            cout&lt;&lt;\"Already Occupied\\n\"; \/\/Warn user to fill the blank space\n            continue;\/\/Don't count this in \"variable v\" means don't increment the variable \"v\"\n                    \/\/as it was invalid move\n        }\n\n        \/\/ After three attempts it will check , this code is for system\n        if(v&gt;2)\n            user_status=chance_of_win(matrix,i,j,0);\/\/User chance of win\n\n        \/\/checkwin whether game is over i.e whether user win\n        if(v&gt;4){\n            if(checkwin(matrix,i,j,0)){\n                cout&lt;&lt;\"\\n\\tBingo !! User win\\n\\tCongrats Well played\\n\";\n                display(matrix);\n                return 0;\n            }\n         }\n\n        flag=false;\/\/ Let the System play next move\n        display(matrix);\/\/display the matrix\n        cout&lt;&lt;\"\\nWait! System turns\\n\";\n    }\n\n    else{\/\/System's Turn\n        if(system1==true){\/\/Chance of System of winning\n            j=system_status%10;\/\/get the j coordinate\n            i=system_status\/10;\/\/get the i coordinate\n            \/\/cout&lt;&lt;\"System chance win i = \"&lt;&lt;i&lt;&lt;\" j = \"&lt;&lt;j&lt;&lt;endl;\n\n            \/*If Structure of Check whether place is empty for winning the system*\/\n            if(matrix[i][j]==BLANK){\/\/Is place is empty\n                matrix[i][j]=1;\n                if(checkwin(matrix,i,j,1)){\n                    display(matrix);\/\/Display the current scenerio of the game\n                    cout&lt;&lt;\"Sorry You loose !! System wins\\n\";\n                    return 0;\n                }\/\/end if structure of check win\n            }\n            else\/\/Means space is occupied by user, and chance of winning by system is lost\n                system1=false;\/\/Now let the system to defense the user's move\n            \/*Ends If Structure of Check whether place is empty for winning the system*\/\n        }\n\n        if(system1==false){\n            if(user_status!=0){\/\/If User is going to win , warn the system\n                j=user_status%10;\/\/get the j coordinate\n                i=user_status\/10;\/\/get the i coordinate\n                \/\/cout&lt;&lt;\"User chance win i = \"&lt;&lt;i&lt;&lt;\" j = \"&lt;&lt;j&lt;&lt;endl;\n            }\n            else{\n                if(v==9){\/\/There is no point to check random number if noone is winning at the end\n                        cout&lt;&lt;\"\\t\\tMatch draw\"&lt;&lt;endl;\n                        return 0;\n                }\n                srand(time(NULL));\n                i=rand()%3; \/\/random i coordinate\n                srand(time(NULL));\n                j=rand()%3; \/\/random j coordinate\n            }\n            \/*If System turn's of writting*\/\n            if(matrix[i][j]==BLANK)\n                matrix[i][j]=1;\n            else\n                continue;\n            \/*End If Structure of writting system turn's*\/\n        }\/\/end If Structure is sytem chance of win = false\n\n        if(v&gt;2){\/\/ This condition is necessary to avoid irrevelant check\n            system_status=chance_of_win(matrix,i,j,1); \/\/System chance of win\n            if(system_status==0){\n                    system1=false;\n                    cout&lt;&lt;\"\\n Not System Chance of win \\n\";\n            }\n            else{\n                system1=true;\n                cout&lt;&lt;\"\\n System Chance of win \\n\";\n            }\n        }\n        else{\n            system_status=0;\n            system1=false;\n        }\n\n        flag=true;\/\/Let the user play his next move\n        display(matrix);\n\n    }\nv++;\n}\/\/end of while v&lt;9\n\nreturn 0;\n}\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\"><\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] \/\/Play Tic Tac Toe game between user and computer #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;stdlib.h&gt; #include&lt;time.h&gt; #define BLANK 5 using namespace std; \/***************** Display the Matrix **********************************************\/ \/\/Display the matrix void display(int matrix[3][3]) { for(int i=0;i&lt;3;i++){ for(int j=0;j&lt;3;j++) cout&lt;&lt;matrix[i][j]&lt;&lt;&#8220;\\t&#8221;; cout&lt;&lt;endl; } } \/************** Chance of WIN Function *****************************************************\/ \/\/Funtion to detect the chance of either for user &#8230; <a title=\"[Solved] Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\" aria-label=\"More on [Solved] Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[324,2462,806],"class_list":["post-8692","post","type-post","status-publish","format-standard","hentry","category-solved","tag-c","tag-tic-tac-toe","tag-vector"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] Creating a tic tac toe game. I want to create a 3x3 vector that stores the values for rows and columns then print out the board in the function - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Creating a tic tac toe game. I want to create a 3x3 vector that stores the values for rows and columns then print out the board in the function - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] \/\/Play Tic Tac Toe game between user and computer #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;stdlib.h&gt; #include&lt;time.h&gt; #define BLANK 5 using namespace std; \/***************** Display the Matrix **********************************************\/ \/\/Display the matrix void display(int matrix[3][3]) { for(int i=0;i&lt;3;i++){ for(int j=0;j&lt;3;j++) cout&lt;&lt;matrix[i][j]&lt;&lt;&quot;t&quot;; cout&lt;&lt;endl; } } \/************** Chance of WIN Function *****************************************************\/ \/\/Funtion to detect the chance of either for user ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-14T19:34:36+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function\",\"datePublished\":\"2022-09-14T19:34:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\"},\"wordCount\":62,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"c++\",\"tic-tac-toe\",\"vector\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\",\"name\":\"[Solved] Creating a tic tac toe game. I want to create a 3x3 vector that stores the values for rows and columns then print out the board in the function - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-09-14T19:34:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Creating a tic tac toe game. I want to create a 3x3 vector that stores the values for rows and columns then print out the board in the function - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Creating a tic tac toe game. I want to create a 3x3 vector that stores the values for rows and columns then print out the board in the function - JassWeb","og_description":"[ad_1] \/\/Play Tic Tac Toe game between user and computer #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;stdlib.h&gt; #include&lt;time.h&gt; #define BLANK 5 using namespace std; \/***************** Display the Matrix **********************************************\/ \/\/Display the matrix void display(int matrix[3][3]) { for(int i=0;i&lt;3;i++){ for(int j=0;j&lt;3;j++) cout&lt;&lt;matrix[i][j]&lt;&lt;\"t\"; cout&lt;&lt;endl; } } \/************** Chance of WIN Function *****************************************************\/ \/\/Funtion to detect the chance of either for user ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/","og_site_name":"JassWeb","article_published_time":"2022-09-14T19:34:36+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function","datePublished":"2022-09-14T19:34:36+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/"},"wordCount":62,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["c++","tic-tac-toe","vector"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/","url":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/","name":"[Solved] Creating a tic tac toe game. I want to create a 3x3 vector that stores the values for rows and columns then print out the board in the function - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-09-14T19:34:36+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-tic-tac-toe-game-i-want-to-create-a-3x3-vector-that-stores-the-values-for-rows-and-columns-then-print-out-the-board-in-the-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Creating a tic tac toe game. I want to create a 3&#215;3 vector that stores the values for rows and columns then print out the board in the function"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/8692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=8692"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/8692\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=8692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=8692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=8692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}