C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 28th, 2004, 11:32 PM
StuckProgrammer StuckProgrammer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 StuckProgrammer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Stuck

ok usually I can take a break come back and bam theres the problem... Unfortunately not this time.
I'm getting an error message before the 'else'. Any help would be much appriciated!

Code:
  
/* This program will read in up to 24 Temperatures as integers. It will also Calculate the highest 
and lowest temperatures and then give and average of the temperatures .*/
 
#include <iostream>
#include <iomanip>
 
using namespace std;
 
int aTemp, counter, numRead, highest, lowest;
double avg;
 
int main()
{
cout << "Enter the number of temperature to be read: ";
cin >> numRead;
 
if (numRead > 24 || numRead < 0);
{
cout << "Error: The number of temperatures entered must be under 24.";
else
cout << "Enter the list of temperatures: ";
} 
 
cin >> aTemp;// Calculate first temperature checks the records to see if its the highest and lowest
 
for(counter = 1; counter <= numRead; counter++)
{
cin >> aTemp;
 
if(aTemp > highest)// Update the highest so far, if necessary
{
highest = aTemp;
}
if(aTemp < lowest)// Update the lowest so far, if necessary
{
lowest = aTemp;
}
}
avg = ((highest + lowest)/ counter);
 
cout << "The highest temperature is: " << highest << endl; 
cout << "The average temperature is: " << avg << endl;
cout << "The lowest temperature is: " << lowest << endl;
return 0;
}

Reply With Quote
  #2  
Old November 29th, 2004, 02:06 PM
StuckProgrammer StuckProgrammer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 StuckProgrammer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Sad

thats very sad that out of the 25 people who viewed no one caught that my mistake was that the if statemtent had a semicolon. I'm making sure not to recommend this site to anyone.

Reply With Quote
  #3  
Old November 30th, 2004, 08:43 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Remind me again why its sad that people are trying to help you?

Reply With Quote
  #4  
Old December 5th, 2004, 02:43 AM
Evoltix Evoltix is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Nebraska
Posts: 14 Evoltix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Evoltix Send a message via Yahoo to Evoltix
I'm sure with your attitude you probably don't have anyone to recommend this site to in the first place. Sometimes you're not going to get a response immediately and if you don't just look back at your work to see if you can solve it yourself. Keep checking back to see if people have responded. You don't have to get mad at this site because you found the problem before anybody else did.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Stuck


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT