#include
#include
#include
using namespace std;
const int M = 9 + 10;
int a[M][M], t[M];
void err (char c, int n) {
string s = "soooooooooooooooti";
if (c == 'c')
s = "soton ";
if (c == 'r')
s = "satr ";
if (c == 's')
s = "morabaa ";
cout << s << n << " eshkal dare\n";
exit (0);
}
int main () {
for (int i=1; i<10; i++)
for (int j=1; j<10; j++)
cin >> a[i][j];
//satr
for (int i=1; i<10; i++) {
memset (t, 0, sizeof(t));
for (int j=1; j<10; j++){
if (t[ a[i][j] ] == 1)
err ('r', i);
t[ a[i][j] ] = 1;
}
}
//soton
for (int j=1; j<10; j++) {
memset (t, 0, sizeof (t));
for (int i=1; i<10; i++) {
if (t[ a[i][j] ] == 1)
err ('c', j);
t[ a[i][j] ] = 1;
}
}
char c;
cout << "mikhay morabaha ro ham bebinam? (y/n)\n";
cin >> c;
if (c == 'y') {
for (int x=1; x<10; x += 3)
for (int y=1; y<10; y +=3) {
memset (t, 0, sizeof (t));
for (int i=x; i < x+3; i++)
for (int j=y; j < y+3; j++) {
if (t[ a[i][j] ] == 1)
err('s', x*10 + y);
t[ a[i][j] ] = 1;
}
}
}
return 0;
}
Algorithm
#include
#include
#include
using namespace std;
const int M = 9 + 10;
int a[M][M], t[M];
void err (char c, int n) {
string s = "soooooooooooooooti";
if (c == 'c')
s = "soton ";
if (c == 'r')
s = "satr ";
if (c == 's')
s = "morabaa ";
cout << s << n << " eshkal dare\n";
exit (0);
}
int main () {
for (int i=1; i<10; i++)
for (int j=1; j<10; j++)
cin >> a[i][j];
//satr
for (int i=1; i<10; i++) {
memset (t, 0, sizeof(t));
for (int j=1; j<10; j++){
if (t[ a[i][j] ] == 1)
err ('r', i);
t[ a[i][j] ] = 1;
}
}
//soton
for (int j=1; j<10; j++) {
memset (t, 0, sizeof (t));
for (int i=1; i<10; i++) {
if (t[ a[i][j] ] == 1)
err ('c', j);
t[ a[i][j] ] = 1;
}
}
char c;
cout << "mikhay morabaha ro ham bebinam? (y/n)\n";
cin >> c;
if (c == 'y') {
for (int x=1; x<10; x += 3)
for (int y=1; y<10; y +=3) {
memset (t, 0, sizeof (t));
for (int i=x; i < x+3; i++)
for (int j=y; j < y+3; j++) {
if (t[ a[i][j] ] == 1)
err('s', x*10 + y);
t[ a[i][j] ] = 1;
}
}
}
return 0;
}
#include
#include
#include
using namespace std;
const int M = 9 + 10;
int a[M][M], t[M];
void err (char c, int n) {
string s = "soooooooooooooooti";
if (c == 'c')
s = "soton ";
if (c == 'r')
s = "satr ";
if (c == 's')
s = "morabaa ";
cout << s << n << " eshkal dare\n";
exit (0);
}
int main () {
for (int i=1; i<10; i++)
for (int j=1; j<10; j++)
cin >> a[i][j];
//satr
for (int i=1; i<10; i++) {
memset (t, 0, sizeof(t));
for (int j=1; j<10; j++){
if (t[ a[i][j] ] == 1)
err ('r', i);
t[ a[i][j] ] = 1;
}
}
//soton
for (int j=1; j<10; j++) {
memset (t, 0, sizeof (t));
for (int i=1; i<10; i++) {
if (t[ a[i][j] ] == 1)
err ('c', j);
t[ a[i][j] ] = 1;
}
}
char c;
cout << "mikhay morabaha ro ham bebinam? (y/n)\n";
cin >> c;
if (c == 'y') {
for (int x=1; x<10; x += 3)
for (int y=1; y<10; y +=3) {
memset (t, 0, sizeof (t));
for (int i=x; i < x+3; i++)
for (int j=y; j < y+3; j++) {
if (t[ a[i][j] ] == 1)
err('s', x*10 + y);
t[ a[i][j] ] = 1;
}
}
}
return 0;
}
To download the exe file code
Click Downloads
IF you have comments or ideas leave them below
moncler, moncler outlet, links of london, bottes ugg, moncler, moncler, doudoune canada goose, sac louis vuitton pas cher, juicy couture outlet, canada goose, moncler, pandora charms, pandora charms, replica watches, louis vuitton, pandora jewelry, lancel, canada goose, louis vuitton, ugg boots uk, swarovski, louis vuitton, canada goose uk, wedding dresses, moncler, ugg,uggs,uggs canada, hollister, supra shoes, juicy couture outlet, toms shoes, canada goose outlet, ugg pas cher, montre pas cher, canada goose, moncler, karen millen, swarovski crystal, louis vuitton, pandora jewelry, ugg,ugg australia,ugg italia, marc jacobs, thomas sabo, coach outlet, moncler, canada goose, canada goose outlet
ReplyDeletejimmy choo shoes, converse outlet, north face outlet, insanity workout, soccer jerseys, wedding dresses, nike air max, ralph lauren, mcm handbags, oakley, hollister, lululemon, mont blanc, valentino shoes, vans shoes, vans, abercrombie and fitch, nike huarache, new balance, hollister, bottega veneta, nike trainers, birkin bag, celine handbags, ghd, soccer shoes, asics running shoes, instyler, timberland boots, beats by dre, nfl jerseys, converse, reebok shoes, nike roshe, hollister, ferragamo shoes, p90x workout, gucci, louboutin, north face outlet, iphone cases, babyliss, chi flat iron, baseball bats, longchamp, ray ban, nike air max, herve leger, mac cosmetics
ReplyDeleteLovelyy blog you have here
ReplyDelete