| 18525 | 2025-10-25 19:37:41 | szabelr | Sakktábla bábukkal | cpp17 | Forditási hiba |
// sakktabla1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
int main()
{
char a = "0", b = "0";
int lehete = 1;
string q;
char x;
for (int i = 0; i <= 7; i++) {
cin >> q;
for (int y = 0; y <= 7; y++) {
x = q[y];
if (x != "F") {
if (i % 2 == 0 and y % 2 == 1) {
if (a == "0")
a = x;
else if (x != a)
lehete = 0;
}
if (i % 2 == 1 and y % 2 == 1) {
if (b == "0" )
b = x;
else if (x != b)
lehete = 0;
}
if (i % 2 == 0 and y % 2 == 0) {
if (b == "0")
b = x;
else if (x != b)
lehete = 0;
}
if (i % 2 == 1 and y % 2 == 0) {
if (a == "0")
a = x;
else if (x != a)
lehete = 0;
}
if (a == b)
lehete = 0;
}
}
}
if (lehete == 1)
cout << "LEHETSEGES";
else
cout << "LEHETETLEN";
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
open /var/local/lib/isolate/428/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:9:15: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
9 | char a = "0", b = "0";
| ^~~
| |
| const char*
main.cpp:9:24: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
9 | char a = "0", b = "0";
| ^~~
| |
| const char*
main.cpp:17:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
17 | if (x != "F") {
| ~~^~~~~~
main.cpp:19:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
19 | if (a == "0")
| ~~^~~~~~
main.cpp:26:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
26 | if (b == "0" )
| ~~^~~~~~
main.cpp:32:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
32 | if (b == "0")
| ~~^~~~~~
main.cpp:38:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
38 | if (a == "0")
| ~~^~~~~~