darkAngel 0 Newbie Poster

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";
}
darkAngel 0 Newbie Poster

it shouldn't happen. try

#include <iostream>
int main () {
    int test [5]={0};
    cout<<test[0];
}
darkAngel 0 Newbie Poster

as above.

string s;
cin >> s;

for example, if the user enters Orange, i want it to convert to orange.
please advise what i should do.


thanks in advance