185242025-10-25 19:30:25szabelrSakktábla bábukkalcpp17Forditási hiba
// sakktabla1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;

int main()
{
    string  a = "0", b = "0";
    int lehete = 1;
    string x,q;
    for (int i = 0; i <= 7; i++) {
        
            cin >> q;
            for (int y = 0; y <= 7; y++) {
                char x = q[y];
                if (x != "F") {
                    if (i % 2 == 0 and y % 2 == 1) {
                        if (a == "0")
                            a = x;
                        else if (x != a or x==b)
                            lehete = 0;
                    }
                    if (i % 2 == 1 and y % 2 == 1) {
                        if (b == "0")
                            b = x;
                        else if (x != b or x==a)
                            lehete = 0;
                    }
                    if (i % 2 == 0 and y % 2 == 0) {
                        if (b == "0")
                            b = x;
                        else if (x != b or x==a)
                            lehete = 0;
                    }
                    if (i % 2 == 1 and y % 2 == 0) {
                        if (a == "0")
                            a = x;
                        else if (x != a or x == 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
Forditási hiba
open /var/local/lib/isolate/411/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:17:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |                 if (x != "F") {
      |                     ~~^~~~~~
main.cpp:21:36: error: no match for 'operator!=' (operand types are 'char' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   21 |                         else if (x != a or x==b)
      |                                  ~ ^~ ~
      |                                  |    |
      |                                  char std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/12/iosfwd:40,
                 from /usr/include/c++/12/ios:38,
                 from /usr/include/c++/12/ostream:38,
                 from /usr/include/c++/12/iostream:39,
                 from main.cpp:4:
/usr/include/c++/12/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
  197 |     operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/postypes.h:197:5: note:   template argument deduction/substitution failed:
main.cpp:21:39: note:   mismatched types 'const std::fpos<_StateT>' and 'char'
   21 |                         else if (x != a or x==b)
      |                                       ^
In file included from /usr/include/c++/12/string:41,
                 from /usr/include/c++/12/bits/locale_classes.h:40,
                 from /usr/include/c++/12/bits/ios_base.h:41,
                 from /usr/include/c++/12/ios:42:
/usr/include/c++/12/bits/allocator.h:226:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
  226 |     operator!=(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/12/bits/allocator.h:226:5: note:   template argument deduction/substitution failed:
main.cpp:21:39: no...