lundi 10 octobre 2016

Easier way to write this if function c++

is there an easier way to write this if statement?

int main ()
        {
            char k[100];
            int i=0;
            ifstream fd ("info.txt");
            while (!in.eof())
            {
            fd >> k[i]
            if (int(k[i]) != 96 || int(k[i]) != 97 || int(k[i]) != 98 || int(k[i]) != 99)
            i++;
            } 

and so on till 122. Basically all I want to do is check if the symbol in the .txt file matches all the alphabet letters, @ sign and a " . " (period)

Is there an easier way to do all of this? Any help is much appreciated !

Aucun commentaire:

Enregistrer un commentaire