Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include<iostream> using namespace std; //Function Prototypes double ascending(d

ID: 3627893 • Letter: #

Question

#include<iostream>
using namespace std;

//Function Prototypes
double ascending(double, int);
double descending(double, int);
double average (double, int, double);
//double highest(double);
//void lowest();

//Global Variables
const int NUM_UNITS = 150;
double scores[NUM_UNITS];
double total = 0;
double avg;
double lowest;
double highest;


void main()
{
int count = 0;
char letter;

cout<<"THIS PROGRAM WILL READ AN UNKNOWN NUMBER OF SCORES. THEN IT WILL"<<endl;
cout<<"PRINT THE LIST OF SCORES, THE SCORES FROM LOWEST TO HIGHEST,"<<endl;
cout<<"THE SCORES FROM HIGHEST TO LOWEST, THE HIGHEST SCORE, THE LOWEST SCORE"<<endl;
cout<<"AND THE AVERAGE OF THE SCORES."<<endl;
cout<<"--------------------------------------------------------------------------------"<<endl;



cout<<"Please Enter Score"<<" "<<count++<<" "<<":";
cin>>scores[NUM_UNITS];
for (int count = 0; count< NUM_UNITS;count++)
{
total += scores[count];
}

cout<<"Do You Want To Enter Another Score(Enter Y for Yes And N For No)?";
cin>>letter;
if(letter == 'N' || letter == 'n')
{
//Calling ascending function
scores[count]=ascending(scores[NUM_UNITS], NUM_UNITS);
cout<<"The Lowest Number is:"<<lowest<<endl;
cout<<"The Ascending Order is:"<<scores[count]<<endl;

//Calling lowest function
//lowest();

//Calling descending function
scores[count]=descending(scores[NUM_UNITS], NUM_UNITS);
cout<<"The Highest Number is:"<<highest<<endl;
cout<<"The Descending Order is:"<<scores[count]<<endl;

//Calling Highest function
//highest();

//Calling average function
avg = average(total, NUM_UNITS, avg);
cout<<"Average ="<<" "<<avg<<endl;

}
//else if (letter != 'Y' || letter!='y')
//{
// cout<<"INVALID CHOICE. PLEASE ENTER AGAIN:";
// cin>>letter;
//}

}

double ascending(double scores[NUM_UNITS], int NUM_UNITS)
{
int count;

lowest = scores[0];
for(count=1; count<NUM_UNITS; count++)
{
if (scores[count] < lowest)
lowest = scores[count];
}

return scores[count];
}

//void lowest()
//{
// cout<<"Lowest Score is:"<<lowest<<endl;
//}

double descending(double scores[NUM_UNITS], int NUM_UNITS)
{
int count;

highest = scores[0];
for(count=1; count<NUM_UNITS; count++)
{
if (scores[count] > highest)
highest = scores[count];
}
return scores[count];
}

//double highest(double HighNum)
//{
// HighNum = highest[0];

//}

double average(double total, int NUM_UNITS, double avg)
{

avg = total/NUM_UNITS;
return avg;
return avg;
}


I tried to solve this program and it gave me this error:
Practice - Sorting Arrays.obj : error LNK2019: unresolved external symbol "double __cdecl descending(double,int)" (?descending@@YANNH@Z) referenced in function _main
Practice - Sorting Arrays.obj : error LNK2019: unresolved external symbol "double __cdecl ascending(double,int)" (?ascending@@YANNH@Z) referenced in function _main
C:Documents and SettingsUsermy documents isual studio 2010ProjectsPractice - Sorting ArraysDebugPractice - Sorting Arrays.exe : fatal error LNK1120: 2 unresolved externals

Thanks for the help.

Explanation / Answer

please rate - thanks

it now compiles cleanly

#include<iostream>
using namespace std;

//Function Prototypes
double ascending(double[], int);
double descending(double[], int);
double average (double, int, double);
//double highest(double);
//void lowest();

//Global Variables
const int NUM_UNITS = 150;
double scores[NUM_UNITS];
double total = 0;
double avg;
double lowest;
double highest;


int main()
{
int count = 0;
char letter;

cout<<"THIS PROGRAM WILL READ AN UNKNOWN NUMBER OF SCORES. THEN IT WILL"<<endl;
cout<<"PRINT THE LIST OF SCORES, THE SCORES FROM LOWEST TO HIGHEST,"<<endl;
cout<<"THE SCORES FROM HIGHEST TO LOWEST, THE HIGHEST SCORE, THE LOWEST SCORE"<<endl;
cout<<"AND THE AVERAGE OF THE SCORES."<<endl;
cout<<"--------------------------------------------------------------------------------"<<endl;



cout<<"Please Enter Score"<<" "<<count++<<" "<<":";
cin>>scores[NUM_UNITS];
for (int count = 0; count< NUM_UNITS;count++)
{
total += scores[count];
}

cout<<"Do You Want To Enter Another Score(Enter Y for Yes And N For No)?";
cin>>letter;
if(letter == 'N' || letter == 'n')
{
//Calling ascending function
scores[count]=ascending(scores, NUM_UNITS);
cout<<"The Lowest Number is:"<<lowest<<endl;
cout<<"The Ascending Order is:"<<scores[count]<<endl;

//Calling lowest function
//lowest();

//Calling descending function
scores[count]=descending(scores, NUM_UNITS);
cout<<"The Highest Number is:"<<highest<<endl;
cout<<"The Descending Order is:"<<scores[count]<<endl;

//Calling Highest function
//highest();

//Calling average function
avg = average(total, NUM_UNITS, avg);
cout<<"Average ="<<" "<<avg<<endl;

}
//else if (letter != 'Y' || letter!='y')
//{
// cout<<"INVALID CHOICE. PLEASE ENTER AGAIN:";
// cin>>letter;
//}

}

double ascending(double scores[NUM_UNITS], int NUM_UNITS)
{
int count;

lowest = scores[0];
for(count=1; count<NUM_UNITS; count++)
{
if (scores[count] < lowest)
lowest = scores[count];
}

return scores[count];
}

//void lowest()
//{
// cout<<"Lowest Score is:"<<lowest<<endl;
//}

double descending(double scores[NUM_UNITS], int NUM_UNITS)
{
int count;

highest = scores[0];
for(count=1; count<NUM_UNITS; count++)
{
if (scores[count] > highest)
highest = scores[count];
}
return scores[count];
}

//double highest(double HighNum)
//{
// HighNum = highest[0];

//}

double average(double total, int NUM_UNITS, double avg)
{

avg = total/NUM_UNITS;
return avg;
return avg;
}