thank you everybody. Problem resolved with Lerner's method. BTW, below is my full program
#include <iostream>
#include <string>
using namespace std;
int main (void) {
//char *fruit[] = {“apple”, ”banana”, “melon”, “orange”, “pear”};
int stock[] = {32, 10, 30, 50, 25};
bool available = 0;
//cout << fruit[0];
string s[] = {"apple","banana","melon","orange","pear"};
string i;
cout << "Enter the name of fruit\n";
cin >> i;
for (int q=0; q<i.length(); q++) {
i[q]=tolower(i[q]);
}
for (int k=0; k<5; k++) {
if (i==s[k]) {
cout << stock[k] << "in stock";
available=1;
break;
}
}
if (available==0)
cout << "ERROR!!! Item entered is not available";
}