samedi 20 janvier 2018

Any explanation of the working of the following code?

The objective of the program is to find out that a given input is a character or number. I'm trying to write the smallest possible code without using library functions, and I found a way (given below), but I don't know how this works. How does this code works,anyone please answer this question.

main()
{

    int i;     
    char c;    
    cout<<"Enter:";
    cin>>i;
    if(c==i)
        cout<<"character";
    else
        cout<<"num";
    return 0;

}

Aucun commentaire:

Enregistrer un commentaire