I have been working on this for a while but I can not seem to figure it out, the program compiles but if the user enters a string value that is equal to an element in the array, it doesn't fallow through with the appropriate code, it is equal, but it doesnt think it is..... it sounds stupid but....... Code: ////////////main//////////// Gen Genesis; Genesis.initialize(); Genesis.input_allcaps(Genesis.get_userinput()); Genesis.check_userinput(); ////////////////////////////////////////////////////// /////////definitions///////////////////////////////// string known_statements[known_reference] = {"HELLO"}; string Gen::get_userinput(){ getline(cin, userinput); //// I tested it by typing hello for the input ///// return userinput; } void Gen::input_allcaps(string input){ for (int i = 0; i < input.length(); i++){ userinput[i]=toupper(input[i]); } cout << userinput; } string Gen::check_userinput(){ for (int cntr = 0; cntr < known_reference; cntr++){ if(userinput == known_statements[cntr]){ cout << userinput << " = " << known_statements[cntr] << "n"; } } return _response; } should i be using pointers, if so how? any help would be appreciated -Brett
From what you've shown here, I don't see any reason why it shouldn't work. Maybe you should show your real code?