hello guys i made code cause i wanted to see if could make it read chracters and not numbers, beacuase i know there is another way to make this with something like a menu but the user responds in numbers and i wanted to do some thing diferent xd.
#include<iostream>
#include <stdlib.h>
using namespace std;
int main (){
char r [8];
cout<< "is milk white? yes or no?: ";
cin>> r;
if ( 'r'=='no'){
cout<< "im really disappointed"<<endl;
}
else if ('r'=='yes'){
Even removing the single quotes from "r" will not solve your problem because first (yes) and (no) need to be in double quotes. and even then the "==" will not wor with a C style character array. You would need to use the C function "strcmp()" to compare the two.
Another option is to include the header file "string" and define "r" as a std::string and long with enclosing (yes) and (no) in double quotes the "==" will work.