I cant figure out how to plug in my vectors for my High and Low. I am fairly new please Help.

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include "conio.h"
using namespace std;

//Create a datatype to represent weather station...

struct SurveyInfo  {
	string LocationID;  //The location of the Weather Station...
	double Temperature;     //The Temperature in Ferenheight...
	double Celsius;  //The Temperature Celsius...
};
//Declare the functions...

vector<SurveyInfo> Initialize();
vector<SurveyInfo> PostInfo(vector<SurveyInfo>);
void Daily(vector<SurveyInfo>);
void HiLow(vector<SurveyInfo>);
void Menu();

int main()
	{
		vector<SurveyInfo> List;  //We need a vector to hold the information...
		string Command = "";  //we need a variable to receive the user request...
											//Notice it's initialized to a harmless value...

		List = Initialize();  //First, initialize the Weathor Station vector...

		while(Command != "Quit")  {
			Menu();

			cout  << "Command: ";
			getline(cin, Command);

			if(Command == "Post")
				List = PostInfo(List);  //...Get the values for each location...
			else if(Command == "Daily")
				Daily(List);	//Display the report...
			else if(Command == "HighLow")
				HighLow(List);	//Display the report...

		 }

		system("pause");       
 }

//We need a Menu function to help drive the command processor...

void Menu()
{
		cout << "Choices......................................................." << endl;
		cout << "==============================================================" << endl;
		cout << "\tPost......allows the user to post temperatures." << endl;
		cout << "\tDaily...display the report of high and low temperatures." << endl;
		cout << "\tQuit......exits the program." << endl;
		cout << "==============================================================" << endl;
}
//This sets up the list with the values of the locations...

vector<SurveyInfo> Initialize()
{
		vector<SurveyInfo> TemperatureList;  //Create a vector of weather stations...
		SurveyInfo Buffer;
    
		Buffer.LocationID = "Tciitcgaitc" ;  //Then initialize it...
		TemperatureList.push_back(Buffer) ;

		Buffer.LocationID= "Redwood Haven";
		TemperatureList.push_back(Buffer);

		Buffer.LocationID = "Barrier Mts.";
		TemperatureList.push_back(Buffer);

		Buffer.LocationID = "Nina's Folly";
		TemperatureList.push_back(Buffer);

		Buffer.LocationID = "Sooly's Hill";
		TemperatureList.push_back(Buffer);

		Buffer.LocationID = "Twin Cones Park";
		TemperatureList.push_back(Buffer);

		return TemperatureList;  //Send it back to the caller...
}
//This function allows the user to enter the values at each location...

vector<SurveyInfo> PostInfo(vector<SurveyInfo> List)
{
	cout << "Enter Temperatures Below...\n" << endl;

	double Count;
	double Ferenheight;    //These variables get the values from the keyboard...
	double Celsius;

	for(Count = 0 ; Count < 6 ; Count++)  {
		cout << "Weather Station: " << List[Count].LocationID << endl;  //Display the location of the fishing spot...
		cout << "\tTemperature: ";   //Get the Temperature in Ferenheight...
		cin >> Ferenheight;
		List[Count].Temperature = Ferenheight;  //...put them into the object...
	}

	cin.ignore(100, '\n');  //This fixed a common problem that occurs when you go from numeric 
	                                    //  to string input...note that '\n' is a character and and not a string...
	return List;
}
//This puts out the report for the weeks fishing...

void Daily(vector<SurveyInfo> List)
{
	double Count;

	//This section is the report...it's really all about the formatting...

	cout << "\n\t=============================================================" << endl;  
    cout << "\tDaily" << endl;
    cout << "\t===============================================================" << endl;
    cout << "\tLocation\t\tFerenheight\tCelsius" << endl;
    cout << "\t===============================================================" << endl;
	for(Count = 0 ; Count < 6 ; Count++) 
		cout << "\t" << List[Count].LocationID  << "\t\t" << List[Count].Temperature << "\t		" 
		                      << setprecision(3) << (5 *(List[Count].Temperature - 32)) / 9 << endl;  
           
    cout << "\t===============================================================\n\n" << endl;
}
void HighLow(vector<SurveyInfo> List[K])
{

	int K;
   int Low = List[0];            
   int High = List[0];       

   for(K = 0 ; K < 6 ; K++)      
    if(List[K] < Low)
    Low = List[K];

   for(K=0 ;  K < 6 ; K++)    
    if(List[K] > High)
    High = List[K];

   cout << "Lowest Temperature:  " <<Low << endl;
   cout << "Highest Temperature: "<< High << endl;

}
void HighLow( vector<SurveyInfo> List /*[K]*/ ) // typo?
{
   if( List.empty() ) return ; // just to be safe
   
   int K;
   int Low = List[0];            
   int High = List[0];       

   for(K = 0 ; K < /*6*/ List.size() ; K++) // where did 6 come from?     
    if(List[K] < Low)
    Low = List[K];

   for(K=0 ;  K < /*6*/ List.size() ; K++)    
    if(List[K] > High)
    High = List[K];

   cout << "Lowest Temperature:  " <<Low << endl;
   cout << "Highest Temperature: "<< High << endl;

}

Yea the K was a typo.
I just figured 6 since i have 6 vectors or is it suppose to be 5.
So how would i plug in my vectors so it can give me a output of high and Low?

You have just one vector: vector<SurveyInfo> List; defined in main()

A copy of this one vector is passed around, to functions like HighLow()

You could declare/define HighLow() this way, void HighLow( const vector<SurveyInfo>& List ); and you would not even be passing a copy.

This article has been dead for over six months. Start a new discussion instead.