ok welll, i need to know why..
if (yesno=="yes") {
cout<<"Thats quite interesting, thanks for the imput.";
}
will not work. it would really really help me to find out. thanks a lot.
ok welll, i need to know why..
if (yesno=="yes") {
cout<<"Thats quite interesting, thanks for the imput.";
}
will not work. it would really really help me to find out. thanks a lot.
That expression is trying to compare the address of a char* (I am assuming that is what 'yesno' is) to a literal string. This does not work. Instead, you need to use the strcmp function in <cstring>. Here is an example:
Code:#include <cstring> #include <iostream> using namespace std; int main() { // Some code... char* yesno; cin >> yesno; if(strcmp(yesno, "yes") == 0) cout<<"Thats quite interesting, thanks for the imput."; // More code... return 0; }
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
Assuming that yesno is a character array, you can't compare strings with ==, you have to use strcmp() in the string.h header file. Like this:
-PreludeCode:#include <iostream.h> #include <string.h> int main(){ char yesno[] = "yes"; if (strcmp(yesno, "yes")==0) { cout<<"Thats quite interesting, thanks for the imput."; } return 0; }
What is the problem you come to?