C++ Array Implementation

Write a C++ program that reads 10 names and then displays only names that begin with letter A.

Dear @Paul_Muriku, here is the solution… Hope you will understand it :blush:

using namespace std;
#define ll long long int
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL)
int main()
{
    FASTIO;
    string a[11];
    int i;
    cout<<"Enter the names:\n ";
    for(i=0;i<10;i++)
    {
        cin>>a[i];
    }
    cout<<"Names with only starting char 'A' are:\n ";
    for(i=0;i<10;i++)
    {
        string s=a[i];
        if(s[0]=='A' || s[0]=='a')
        cout<<s<<" ";
    }
}
1 Like

Hello Deba,
I’m not sure why it’s not executing in cideblocks. I’m getting errors

Can you please show me the error?
Please upload one screenshot here…

1 Like

It worked buddy. thanks

2 Likes