RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 1211 | Replies: 3 | Thread Tools  Display Modes
Reply
Join Date: Sep 2004
Location: Argyle, Texas
Posts: 21
Reputation: Tomas Lopez is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
Tomas Lopez's Avatar
Tomas Lopez Tomas Lopez is offline Offline
Newbie Poster

Help with a program's error

  #1  
Sep 11th, 2005
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: Metro Detroit
Posts: 135
Reputation: ShaneMcP is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
ShaneMcP's Avatar
ShaneMcP ShaneMcP is offline Offline
Junior Poster

Re: Help with a program's error

  #2  
Sep 11th, 2005
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
Reply With Quote  
Join Date: Feb 2005
Posts: 464
Reputation: winbatch is on a distinguished road 
Rep Power: 4
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: Help with a program's error

  #3  
Sep 11th, 2005
The problem is that you are trying to put something into endl. You can't (and would have no reason to ) send >> into endl.
Reply With Quote  
Join Date: Sep 2004
Location: Argyle, Texas
Posts: 21
Reputation: Tomas Lopez is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
Tomas Lopez's Avatar
Tomas Lopez Tomas Lopez is offline Offline
Newbie Poster

Re: Help with a program's error

  #4  
Sep 11th, 2005
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C++ Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:50 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC