Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Explicit operators

Status
Not open for further replies.

Seron

Technical User
Dec 16, 2001
5
0
0
SE
Hello,

I get this error when I try to compile the code below. Why won't the Borland 5.5 compiler accept the and, or keywords?

Error E2293 Boolean3.cpp 17: ) expected in function main()

// Boolean3.cpp

#include <iostream>
using namespace std;

int main() {
double i,j;
cout << &quot;Enter a value (float): &quot;;
cin >> i;
cout << &quot;Enter another value (float): &quot;;
cin >> j;
cout << &quot;i > j is &quot; << (i > j) << endl;
cout << &quot;i < j is &quot; << (i < j) << endl;
cout << &quot;i >= j is &quot; << (i >= j) << endl;
cout << &quot;i <= j is &quot; << (i <= j) << endl;
cout << &quot;i == j is &quot; << (i == j) << endl;
cout << &quot;i not_eq j is &quot; << (i not_eq j) << endl;
cout << &quot;i and j is &quot; << (i and j) << endl;
cout << &quot;i or j is &quot; << (i or j) << endl;
cout << &quot; (i < 10) and (j < 10) is &quot;
<< ((i < 10) and (j < 10)) << endl;
}

Seron
 
Not equal to !=
AND &
OR |

also AND if(( yaba )&&( dabado ))
OR if(( yaba)||( dabado ))
 
In C++, not_eq is !=, and is &&, and or is ||. Also you need to put
Code:
return 0;
just before the closing bracket. You defined main to return an integer (which is the correct way of defining main()) so you need to return an integer. James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Thanks for the replies.

I've read that the keywords and, or can be used instead of &&, || if the complier complies with Standard C++. Does Borland 5.5 compiler comply to C++ standard? Is it good or bad practise to use one or the other?

Seron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top