How would I output this into:

int main()

I've tried:
int main()
{
PostTemperatures;
}

struct WeatherStation  {
	
	string StationName;
	
	double Temperature;
	
};

void PostTemperatures(WeatherStation BigBasin,WeatherStation Foothill,
			  WeatherStation DeAnza, WeatherStation MiddleField, 
			  WeatherStation RedwoodCity)
{	
	cout<< "Enter reported temperatures..."<<"\n"<< "\n";
	
	BigBasin;
	BigBasin.StationName = "Big Basin";
	cout <<  "Weather Station " << BigBasin.StationName<<"  : ";
	cin >> BigBasin.Temperature;
	
	Foothill;
	Foothill.StationName = "Foothill";
	cout <<  "Weather Station " << Foothill.StationName<<"  : ";
	cin >> Foothill.Temperature;
	
	DeAnza;
	DeAnza.StationName = "DeAnza";
	cout <<  "Weather Station " << DeAnza.StationName<<"  : ";
	cin >> DeAnza.Temperature;
	
	MiddleField;
	MiddleField.StationName = "MiddleField";
	cout <<  "Weather Station " << MiddleField.StationName<<"  : ";
	cin >> MiddleField.Temperature;
	
	RedwoodCity;
	RedwoodCity.StationName = "Redwood City";
	cout <<  "Weather Station " << RedwoodCity.StationName<<"  : ";
	cin >> RedwoodCity.Temperature;
	
}

In other words, how do I call void PostTemperatures?

Ive tried:

PostTemperatures();

But it gives me an error.

"error: at this point in file"

Here is part of the code:

#include<iostream>
#include<vector>
#include<string>

using namespace std;

// Arrays......
int i(0);
double Calc(double fahren);
double Total(0),Celsius[5],Fahrenheit[5];
double CelsiusLowTemperature(0), FahrenheitLowTemperature(1000), 
CelsiusHighTemperature(0), 
FahrenheitHighTemperature(-1000);
double Mean_Celsius, Mean_Fahrenheit ;
string Command;



struct WeatherStation  {
	
	string StationName;
	
	double Temperature;
	
};

void PostTemperatures(WeatherStation BigBasin,WeatherStation Foothill,WeatherStation DeAnza,
					  WeatherStation MiddleField,WeatherStation RedwoodCity)
{

cout<< "Enter reported temperatures..."<<"\n"<< "\n";

BigBasin;
BigBasin.StationName = "Big Basin";
cout <<  "Weather Station " << BigBasin.StationName<<"  : ";
cin >> BigBasin.Temperature;

Foothill;
Foothill.StationName = "Foothill";
cout <<  "Weather Station " << Foothill.StationName<<"  : ";
cin >> Foothill.Temperature;

DeAnza;
DeAnza.StationName = "DeAnza";
cout <<  "Weather Station " << DeAnza.StationName<<"  : ";
cin >> DeAnza.Temperature;

MiddleField;
MiddleField.StationName = "MiddleField";
cout <<  "Weather Station " << MiddleField.StationName<<"  : ";
cin >> MiddleField.Temperature;

RedwoodCity;
RedwoodCity.StationName = "Redwood City";
cout <<  "Weather Station " << RedwoodCity.StationName<<"  : ";
cin >> RedwoodCity.Temperature;


}

void ListMenu() // Displays Weather Report Menu
{
	
	cout<<"Command Choices................"<<"\n"<<endl;
	cout<<"_____________________________"<<"\n"<<endl;
	cout<<"\t"<<"Post Temperatures" <<"\n"<<endl;
	cout<<"\t"<<"Daily Report" <<"\n"<<endl;
	cout<<"\t"<<"High-Low Report" <<"\n" <<endl;
	cout<<"\t"<<"Quit" <<"\n"<<endl;
	cout<<"_____________________________"<<"\n"<<endl;
	//cout<<"Enter Command : "<<endl;
	
}	


void displayData(string str, double val1, double val2) // function
{
	cout.precision(3);
	cout<<str<<val1<<"		"<<val2<<endl;
	cout<<" ---------------------------------------------------"<<endl;
}

double Calc(double fahren) // Function, Converts Fahrenheit to Celsius...
{
	double cel; 
	cel = (5 *(fahren - 32))/9.0;
	return cel;
	
}

int main()
{
	
	
	while(true)  
{
		ListMenu();
		cout << "Enter Command: ";
		getline(cin, Command);
		
		if(Command == "Quit")
			break;
		else if(Command == "Post Temperatures")
			PostTemperatures(); // Here is where the error occurs
		else if(Command == "Daily Report")
			break;
		else if(Command == "High-Low Report")
			break;
			
		
			
}

}

Edited 6 Years Ago by raider650: n/a

#include<iostream>
#include<vector>
#include<string>

using namespace std;

// Arrays......
int i(0);
double Calc(double fahren);
double Total(0),Celsius[5],Fahrenheit[5];
double CelsiusLowTemperature(0), FahrenheitLowTemperature(1000), 
CelsiusHighTemperature(0), 
FahrenheitHighTemperature(-1000);
double Mean_Celsius, Mean_Fahrenheit,  ;
string Command;


struct WeatherStation  {
	
	string StationName;
	
	double Temperature;
	
};


WeatherStation PostTemperatures()	
{
	WeatherStation Values;
	WeatherStation Names;
	
	cout<< "\n"<< "Enter reported temperatures..."<<"\n"<< "\n";
	
	Names.StationName = "Big Basin";
	cout <<  "Weather Station " << Names.StationName<<"  : ";
	cin >> Values.Temperature;
	
	Names.StationName = "Foothill";
	cout <<  "Weather Station " << Names.StationName<<"  : ";
	cin >> Values.Temperature;
	
	Names.StationName = "DeAnza";
	cout <<  "Weather Station " << Names.StationName<<"  : ";
	cin >> Values.Temperature;
	
	Names.StationName = "MiddleField";
	cout <<  "Weather Station " << Names.StationName<<"  : ";
	cin >> Values.Temperature;
	
	Names.StationName = "Redwood City";
	cout <<  "Weather Station " << Names.StationName<<"  : ";
	cin >> Values.Temperature;
	
	return Values;
	return Names;
	
}		

void displayData(string str, double val1, double val2) // function
{
	cout.precision(3);
	cout<<str<<val1<<"		"<<val2<<endl;
	cout<<" ---------------------------------------------------"<<endl;
}



void ListMenu() // Displays Weather Report Menu
{
	
	cout<<"Command Choices................"<<"\n"<<endl;
	cout<<"_____________________________"<<"\n"<<endl;
	cout<<"\t"<<"Post Temperatures" <<"\n"<<endl;
	cout<<"\t"<<"Daily Report" <<"\n"<<endl;
	cout<<"\t"<<"High-Low Report" <<"\n" <<endl;
	cout<<"\t"<<"Quit" <<"\n"<<endl;
	cout<<"_____________________________"<<"\n"<<endl;
	
	
}	

void DailyReport() // Outputs Daily Report
{
	cout.precision(3);
	cout<<" ========NGS Daily Temperature Data Report======== "<<endl; 
	cout<<"                      Fahrenheit	Celsius				  "<<endl;
	//cout<< PostTemperatures()<<endl;
	cout<<" --------------------------------------------------------------"<<endl;
	displayData("Mean Temperature:	", Mean_Fahrenheit , Mean_Celsius);
	cout<<"\n";
}	



void HighLowReport() // Outputs High-Low Report
{
cout<<" ========NGS Temperature Data Report======== "<<endl;
cout<<"                      Fahrenheit	Celsius				  "<<endl;
displayData("Lowest Temperature:	", FahrenheitLowTemperature, CelsiusLowTemperature);
displayData("Highest Temperature:	", FahrenheitHighTemperature, CelsiusHighTemperature);
cout<<" =============End Temperature Data Report============="<<endl;
}


double Calc(double fahren) // Function, Converts Fahrenheit to Celsius...
{
	double cel; 
	cel = (5 *(fahren - 32))/9.0;
	return cel;
	
}


int main()
{
		
	
	while(true)  
{
		ListMenu();
		cout << "Enter Command: ";
		getline(cin, Command);
		
		if(Command == "Quit")
			break;
		else if(Command == "Post Temperatures")
			PostTemperatures();
			
		else if(Command == "Daily Report")
			DailyReport();
			
		else if(Command == "High-Low Report")
			HighLowReport();
			
}
	}

How can I pass the values entered from 'PostTemperatures' into Daily Report and High-low Report.

I've been add it for the last couple of hours and I can't get it to work!

Edited 6 Years Ago by raider650: n/a

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