Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int sudoku[9][9] = {0};
- string veingabe;
- string eingabe[11] = { "" };
- int z = 0, v = 0;
- int s1 = 0, s2 = 0, s3 = 0;
- char c;
- int y;
- cout << "Bitte geben Sie das Sudoku ein:\n";
- for (z == 0; z < 11; z++) // Schleife um das stringarray zu füllen
- {
- cin >> veingabe;//string eingabe
- eingabe[z] = veingabe;// string wird in Array eingefügt
- if (veingabe.at(0) == '.')
- {
- s2 = 0;
- for (s2 == 0; s2 < 9; s2++)
- {
- s3 = 0;
- for (s3 == 0; s3 < veingabe.length(); s3++)
- {
- //if (veingabe.at(s3) >= '1' && veingabe.at(s3) <= '9')
- if ((int(veingabe.at(s3)) >= int('1')) && (int(veingabe.at(s3)) <= int('9')))
- {
- y = int(veingabe.at(s3)) - int('0');
- sudoku[s1][s2] = y;
- s3++;
- break;
- }
- }
- }
- s1++;
- }
- }
- s1 = 0;
- z = 0;
- s2 = 0;
- cout << "Das Sudoku lautet:\n";
- for (z == 0; z < 11; z++)
- {
- if (z != 3 && z != 7)
- {
- s2 = 0;
- for (s2 == 0; s2 < 9; s2++)
- {
- if (s2 == 3 || s2 == 6)
- {
- cout << ";//";
- }
- cout << ";" << sudoku[s1][s2];
- }
- s1++;
- }
- else
- {
- cout << "=======//=======//=======\n";
- continue;
- }
- cout << endl;
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement