Need some help on this problem to merge these two codes


This Content is from Stack Overflow. Question asked by jack is carbon

 #include <iostream>
using namespace std;
int main()
    char c;
    int n;
    cout << " Please enter a letter of the Alphabet and a decimal number";
    cin >> c >> n;
    if (c == 'a'|| c== 'e'|| c== 'i'|| c== 'o'|| c== 'u'||c == 'A'|| c== 'E'|| c== 'I'|| c== 'O'|| c== 'U' )
        cout << c <<  " is a vowel" << endl;
        cout << c << " is a consonant" << endl;

    float x;
    cin >> x;
        if (x<0)
            cout << x << " is less than 0";
        else if (x>0&&x<100)
            cout << x << " is in range ";
            cout << x << " is out of bounds";

        return 0;

The output is this when A, 41.5 is entered:

A is a vowel
nan is out of bounds.

I would like for the code to be able to find the answer to both and tell me whether or not it is below 0, in range, or out of bounds and also say that the letter is a vowel or a consonant, how could I go about doing this?


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?