223032026-01-14 21:02:52madvirSakktábla bábukkalcpp17Forditási hiba
#include <iostream>
#include <string>

int main()
{
    string x="U", y="U", k, l;
    bool yes=true;
    for(int i=0; i<8; i++) {
        cin >> l;
        for(int j=0; j<8; j++) {
            k=l[j];
            if(i%2==j%2) {
                if(x=="U") k=x;
                else if(k!=x) yes=false;
            }
            else {
                if(y=="U") k=y;
                else if(k!=y) yes=false;
            }
        }
    }
    if(yes) cout << "LEHETSEGES";
    else cout << "LEHETETLEN";

    return 0;
}
Forditási hiba
open /var/local/lib/isolate/426/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:6:5: error: 'string' was not declared in this scope
    6 |     string x="U", y="U", k, l;
      |     ^~~~~~
main.cpp:6:5: note: suggested alternatives:
In file included from /usr/include/c++/12/iosfwd:39,
                 from /usr/include/c++/12/ios:38,
                 from /usr/include/c++/12/ostream:38,
                 from /usr/include/c++/12/iostream:39,
                 from main.cpp:1:
/usr/include/c++/12/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included 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/string:65:11: note:   'std::pmr::string'
   65 |     using string    = basic_string<char>;
      |           ^~~~~~
main.cpp:9:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |         cin >> l;
      |         ^~~
      |         std::cin
/usr/include/c++/12/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;           /// Linked to standard input
      |                  ^~~
main.cpp:9:16: error: 'l' was not declared in this scope
    9 |         cin >> l;
      |                ^
main.cpp:11:13: error: 'k' was not declared in this scope
   11 |             k=l[j];
      |             ^
main.cpp:13:20: error: 'x' was not declared in this scope
   13 |                 if(x=="U") k=x;
      |                    ^
main.cpp:17:20: error: 'y' was not declared in this scope
   17 |                 if(y=="U") k=y;
      |                    ^
main.cpp:22:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 |     if(yes) cout << "LEHETSEGES";
      |             ^~~~
      |             std::cout
/usr/include/c++/12/iostream:61:18: note: 'std::cout' declared here
   61 |   ext...