142272025-01-10 09:59:29szabelrTáblajátékcpp17Forditási hiba
#include <iostream>

using namespace std;

int main()
{
    int k,x,sor=0,hely=1;
    cin>>k;
    for(int i=1; i<=k; i++){
        cin>>x;
        if(x==0){
            sor++;
            hely=hely*2-1;
        }
        else if(x==1){
            sor++;
            hely=hely*2;
        }
        else if(x==2){
            sor--;
            hely=hely/2+hely%2;
        }

        else if(x==3){
            hely--;
        }
        else if(x==4){
            hely++;
        }
    }
    cout<<sor<<endl;
    int kettes=0;,z=1
    hely=hely-1;
    while(hely>0){
        kettes=kettes+hely%2*z;
        hely=hely/2;
        z=z*10;
    }
    cout<<kettes;
    for(int i=hossz; i>=1; i--){
        cout<<a[i];
    }
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/444/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:32:18: error: expected primary-expression before ',' token
   32 |     int kettes=0;,z=1
      |                  ^
main.cpp:32:19: error: 'z' was not declared in this scope
   32 |     int kettes=0;,z=1
      |                   ^
main.cpp:40:15: error: 'hossz' was not declared in this scope
   40 |     for(int i=hossz; i>=1; i--){
      |               ^~~~~
main.cpp:41:15: error: 'a' was not declared in this scope
   41 |         cout<<a[i];
      |               ^