2
#include <iostream>
using namespace std;
int main(){
int x, bebida;
cout<<"Digite 'bebida' "<<endl;
cin>>x;
if(x == bebida){
cout<<"Esta certo"<<endl;
}
else{
(x != bebida);
cout<<"Esta errado"<<endl;
}
return 0;
}
The return I want to get is as follows, in case I enter with "drink" the if
I come back with "This right" otherwise "This wrong".
What happens is that no matter what I write, he always returns to me with "This Right".
which return? what you expect?
– rLinhares
you do not initialize the variable "drink", so it was always going to be 0, that’s what you want?
– Math
The return I want to get is the following, In case I enter with "drink" the if me comes back with "This right" otherwise "This wrong". What happens is that regardless of what I write, it always returns to me with "This right".
– Robson Lima
@Math in c++ is not memory junk the value of the uninitialized variable?
– Jefferson Quesado
@Jeffersonquesado do not remember the theory well, but I did a test and that was the result: https://ideone.com/pRqk34
– Math