home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
357_01
/
cstar1.exe
/
BOOL.TST
< prev
next >
Wrap
Text File
|
1991-11-15
|
1KB
|
105 lines
bool_test()
{
char a,b,c,d;
int x,y,z,w;
a = 1;
b = 5;
c = 7;
d = 10;
/* relational operators here */
if (a == b) {
puts("1");
}
else {
puts("0");
}
if (a != b) {
puts("1");
}
else {
puts("0");
}
if (a < b) {
puts("1");
}
else {
puts("0");
}
if (a > b) {
puts("1");
}
else {
puts("0");
}
if (a <= b) {
puts("1");
}
else {
puts("0");
}
if (b >= d) {
puts("1");
}
else {
puts("0");
}
/* boolean operators here */
if (a < b && c < d) {
puts("1");
}
else {
puts("0");
}
if (a < b && c < d || c >= b) {
puts("1");
}
else {
puts("0");
}
if (a < b && (c < d || c >= b)) {
puts("1");
}
else {
puts("0");
}
}
/* a 'notty' set of problems */
if (a < b && ! c < d) {
puts("1");
}
else {
puts("0");
}
if (a < b && ! c < d || c >= b) {
puts("1");
}
else {
puts("0");
}
if (! a < b && (!c < d || c >= b)) {
puts("1");
}
else {
puts("0");
}
/* things to wonder about */
if (a < < b) {
}
if (a + b) {
}
if (a = b) {
}
}