Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool wygranko(int t[3][3]){
- for (int a=0; a<3; a++){
- if (t[a][0]*t[a][1]*t[a][2]==1){
- return true;
- }
- }
- for (int j=0;j<3;j++){
- if (t[0][j]*t[1][j]*t[2][j]==1){
- return true;
- }
- }
- if (t[0][0]*t[1][1]*t[2][2]==1){
- return true;
- }
- if (t[2][0]*t[2][1]*t[2][2]==1){
- return true;
- }
- }
- bool pelna(int t[3][3]) {
- for (int i=0; i<3; i++){
- for (int j=0;j<3;j++){
- if (t[i][j]==0){
- return false;
- }
- }
- }
- return true;
- }
- int suma (int t[3][3]){
- int s=0;
- for(int i=0;i<3;i++){
- for(int j=0;j<3;j++){
- s=s+t[i][j];
- }
- }
- return s;
- }
- void wypisz(int t[3][3]){
- for(int i=0; i<3; i++){
- for (int j=0; j<3; j++){
- if(t[i][j]==1){
- cout << "0";
- }
- else if (t[i][j]==2){
- cout << "X";
- }
- else {
- cout <<" ";}
- if (j<2){
- cout <<"|";
- }
- }
- cout << endl;
- if (i<2){
- cout << "-------" << endl;
- }
- }
- }
- int main() {
- int t[3][3];
- for(int a=0;a<3;a++){
- for (int i=0;i<=2; i++){
- cin >> t[a][i];
- }
- }
- wypisz(t);
- cout << suma(t) << endl;
- cout << pelna(t)<<endl;
- cout << wygranko(t);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement