Hi, I wrote this code but why writing 0 it print true instead of false?
Thanks!
#include <iostream>
int main ()
{
bool a;
std::cout << "insert 0 or 1:";
std::cin >> a;
if (a=true)
{
std::cout << "a is true";
}
else
{
std::cout << "a is false";
}
}
| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | VB Forums | Developer.com |
|
Results 1 to 15 of 22
Thread: problem with booleanThreaded View
|
Click Here to Expand Forum to Full Width |