I'm writing this program for a class and when I tried to compile it I get an error can anyone help me out I can't see to find the problem.
Here is The program with the error:

1: #include <iostream>
2: using namespace std;
3:
4:
5:
6: int main()
7: {
8: int sideOne, sideTwo, sideThree;
9:
10: cout << "Enter the three sides of a triangle." << endl;
11: cin >> sideOne >> sideTwo >> sideThree >> endl;
initializing non-const 'bool &' with 'ostream & (*)(ostream &)' will use a temporary
12:
13: while (cin != 0 || !cin)
14: {
15: cout << "You entered: " << sideOne << ", " << sideTwo << " and, " << sideThree << endl;
16:
17: if (sideOne > 0 && sideTwo > 0 && sideThree > 0)
18: {
19: if (sideOne == sideTwo == sideThree)
20: {
21: cout << "The triangle is equilateral." << endl;
22: }
23: else if (sideOne + sideTwo > sideThree && sideOne == sideTwo
24: || sideOne + sideThree > sideTwo && sideOne == sideThree || sideTwo + sideThree > sideOne
25: && sideTwo == sideThree)
26: {
27: cout << "The Triangle is isosceles." << endl;
28: }
29: else if (sideOne != sideTwo != sideThree && sideOne + sideTwo > sideThree || sideOne + sideThree > sideTwo
30: || sideThree + sideTwo > sideOne)
31: {
32: cout << "The triangle is scalene." << endl;
33: }
34: }
35: else if (sideOne <= 0 || sideTwo <= 0 || sideThree <= 0)
36: {
37: cout << "Error the three sides of the triangle must be greater than 0." << endl;
38: }
39:
40: }
41: return 0;
42: }
/webcpp/cgi-bin/webistream.h: in passing argument 1 of 'webistream :: operator >>(bool &)'

If anyone can give me a hand on this I would really apreciate it.

------------------------------
Tomas Lopez

Recommended Answers

All 3 Replies

11: cin >> sideOne >> sideTwo >> sideThree >> endl;

I don't know about the error, but this probably isnt how you want your user to enter the integer. They will be entering 3 numbers on one line, doesn't look very nice. I'm just picky :P

The problem is that you are trying to put something into endl. You can't (and would have no reason to ) send >> into endl.

Ok thanks that helped, I got it working now. I don't know why i put endl in the cin, but I got it now thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.