A means AMA but i cant figure out whats wrong cuz its gotta accept both capital and small letters help please

#include<iostream.h>
void main()
{
    char x[2];
    cout<<"What does the letter A mean in ACLC?";
    cout<<endl<<"S:";
    cin.getline(x,2);
    {
    if(x[0]=='A'||x[0]=='a')
        x[0]='y';
    else
        x[0]='n';
    {
    }
    if(x[1]=='M'||x[1]=='m')
        x[1]='y';
    else
        x[1]='n';
    }
    {
    if(x[2]=='A'||x[2]=='a')
        x[2]='y';
    else
        x[2]='n';
    }
    if(x[0]=='y' && x[1]=='y' && x[2]=='y')
        cout<<"The Answer is Correct"<<endl;
    else
        cout<<"The Answer is Wrong"<<endl;
}

Recommended Answers

Look up the function toupper() and tolower().

Jump to Post

All 2 Replies

Look up the function toupper() and tolower().

and it would save a lot of space to use strcmp from the string library instead of comparing every index

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.