Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main() {
- string line, white, black;
- vector<vector<char>> chessBoard = vector<vector<char>>(8, vector<char>(8, '.'));
- for (int r = 0; r < 8; r++) {
- getline(cin, line);
- for (int c = 0; c < 8; c++) {
- if (line[c] != '.') {
- char chr = line[c];
- if (isupper(chr)) {
- white += chr;
- }
- else {
- black += chr;
- }
- chessBoard[r][c] = isupper(chr) ? tolower(chr) : toupper(chr);
- }
- }
- }
- cout << (white.empty() ? "<no white figures>" : white) << endl;
- cout << (black.empty() ? "<no black figures>" : black) << endl;
- for (int r = 0; r < 8; r++) {
- for (int c = 0; c < 8; c++) {
- cout << chessBoard[r][c];
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement