Search This Blog

Thursday, 29 November 2012

Variable Data Type: Bool in C++

Bool is a variable data type which can store either 1 or 0.


#include<iostream>
using namespace std;
int main()

{
bool j,k,m;
bool i = j = k = m = 0;
cout<<j<<endl<<i<<endl<<k<<endl<<m<<endl;
return 0;
}
//===============================================================================


#include<iostream>
using namespace std;
int main()

{
bool j,k,m;
bool i = j = k = m = 1;
cout<<j<<endl<<i<<endl<<k<<endl<<m<<endl;
return 0;
}
//===============================================================================

No comments:

Post a Comment