dimanche 24 janvier 2016

C++ If in function not woking

Im completely new to C++ and Im trying to make my own "cmd". Still getting error: "|11|error: return-statement with a value, in function returning 'void' [-fpermissive]|"... Please help :(

Code here:

#include <iostream>
#include <string>

using namespace std;

void cmd(int command)
{
    if (command == login)
    {
        cout << "Prikaz login neni k dispozici!";
        return 0;
    }
    else
    {
        cout << "Prikaz ";
        cout << command;
        cout << " neni znamy!";
        return 0;
    }
}

int main()
{
    cout << "Zadejte prikaz: ";
    cin << command;
    cmd(command);
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire