51862023-04-20 17:46:55idkOszthatóság 31-gyelcpp11Forditási hiba
#include <bits/stdc++.h>

 

using namespace std;

 

void oszt31(int a, vector<int> &vec)
{
    int kulombseg;
    if(a<0)
        cout<<"NEM\n";
    else if(a==0)
        cout<<"IGEN\n";
    else
    {
        int eleje=a/10;
        int utolso=a%10;
        int kulombseg=eleje-3*utolso;
        vec.push_back(kulombseg);
        oszt31(kulombseg, vec);
    }
}

 

int main()
{
    int szam;
    cin>>szam;
    int  kulombseg=szam, eleje, utolso, i;
    vector<int> a;
    vector<int> szamok;

 

    oszt31(szam, szamok);

 

    if(szamok.back()==0)
        for(int x:szamok)
            cout<<x<<" ";
    else if (szamok.back()<0)
        for(i=0;i<szamok.size()-1;i++)
            cout<<szamok.at(i)<<" ";
    else if(szamok.size()==1)
            cout<<endl;
    cout<<endl;

 

    /*do
    {
        eleje=kulombseg/10;
        utolso=kulombseg%10;
        kulombseg=eleje-3*utolso;
        a.push_back(kulombseg);

 

    }while(kulombseg>0);

 

    if(kulombseg==0)
    {
        cout<<"IGEN"<<endl;
        for(i=0;i<a.size();i++)
            cout<<a.at(i)<<" ";
    }
    else
    {
        cout<<"NEM"<<endl;
        for(i=0;i<a.size();i++)
        {
            if(a.at(i)>0)
                cout<<a.at(i)<<" ";
        }
        cout<<endl;
    }*/
    return 0;
}
Forditási hiba
exit status 1
main.cpp:3:1: error: extended character   is not valid in an identifier
    3 |  
      | ^
main.cpp:7:1: error: extended character   is not valid in an identifier
    7 |  
      | ^
main.cpp:11:1: error: extended character   is not valid in an identifier
   11 |     int kulombseg;
      | ^
main.cpp:11:1: error: extended character   is not valid in an identifier
main.cpp:11:1: error: extended character   is not valid in an identifier
main.cpp:12:1: error: extended character   is not valid in an identifier
   12 |     if(a<0)
      | ^
main.cpp:12:1: error: extended character   is not valid in an identifier
main.cpp:12:1: error: extended character   is not valid in an identifier
main.cpp:13:1: error: extended character   is not valid in an identifier
   13 |         cout<<"NEM\n";
      | ^
main.cpp:13:1: error: extended character   is not valid in an identifier
main.cpp:13:1: error: extended character   is not valid in an identifier
main.cpp:13:1: error: extended character   is n...