I have a string array for example

string name[5]={"A","B","B"}

I am accepting an string input from a user and want to check it against that of the array.

cout<<Enter letter;
cin>>letter;

if(toupper(letter)==name[0])
{
............
...........
}

but i am getting an error

Recommended Answers

All 6 Replies

what is the error?

What is toupper() function definition? What's the exact error which is complained by the compiler?

What is toupper() function definition? What's the exact error which is complained by the compiler?

Cannot convert from string to int

Try ... if(toupper(letter).compare(name[0])==0)

see if this works

if (toupper(input) == *(name[0].c_str()))

thanks alot

Be a part of the DaniWeb community

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