Why can't I get the right string. What do I have wrong in the expression? I can't figure it out. I've stocked for hours.
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
using namespace std;
int main (){
string var = "y";
string constant ="y";
if ((var != constant )||( var != "n")){
cout << "error";
}
else {
cout << "right" // this is what it should print
}
}
I understand that or operator uses || as symbol. So why can't my program perform its task
Aucun commentaire:
Enregistrer un commentaire