array max min

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2004
Posts: 2
Reputation: knucklehead is an unknown quantity at this point 
Solved Threads: 0
knucklehead knucklehead is offline Offline
Newbie Poster

array max min

 
-1
  #1
Nov 20th, 2004
I need help with my homework assignment. The assignments asks to enter a list of double values with the maxium to be entered is 50. I need to print out the list entered and find the largest and smallest values entered by the user. This is what I have but I'am getting an unexpected end of file error when I compile my program.

#include <iostream>
#include <cmath>


const int max=50
void readlist(double a[], int s)
void display(double a[], int s)
double largest(double a[], int s)
double lowest(double a[], int s)


int main()

{
using namespace std;
double list [max]

cout<<"Please enter a list size"<<endl;
cin>>list;

if(max>50)
{
cout<<"The size you have entered is too large."<<endl;
cout<<"The maximum size is 50."<<endl;
cout<<"Please re-enter a list size"<<endl;
return 0;
}

void display(double a[], int s)
{
for (i=0;i<size;i++)

cout<<"Please enter some double values "<<endl;
cin>>a[i];



cout<<"The list you have entered is"<<endl;
cin>>list[i];



cout<<list[i]<<" ";
if(i==5)cout<<"endl";
}
double largest(double a[], int s)
double lowest(double a[], int s)
for (i=0;i<size;i++)

if(largest<list[i])
largest=list[i];

{
cout<<"The largest value is:"<<endl;
cin>>largest;
return largest;
}
else if (lowest>list[i])
lowest=list[i];

}
cout<<"The smallest value is:"<<endl;
cin>>lowest;

return lowest;

}
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 10
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: array max min

 
0
  #2
Nov 21st, 2004
Your braces are weird; main doesn't have an ending brace before you start the next function, and you seem to have some mal-formed if statements in regards to the braces.

Re-think where the braces go, and that will help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC