0

I am a beginner and I am using Visual Studio 2008.
My code is good and output is:
Day 1, "Enter Temperature 1:
Day 1, "Enter Temperature 2: and so on until Day 7.
What I want it to read is:
Day 1, "Enter High Temerature 1: (for column [0])
Day 1, "Enter Low Temerature 2: (for column [1])
I have tried several scenarios for cout<<, but I can't seem to get it right. It is OK the way it is, but would be optimal if I could get it to display the "High" and "Low" for each column. Again, any help is greatly appreciated.

int main ()
{
	//declare and intilize array
	int tempav[7][2]= {0};
	int tot = 0;
	int average = 0;

	//enter data into array
	
	for(int day = 0; day < 7; day ++)
		for (int temps = 0; temps < 2; temps ++)
	{

		cout<<"Day Number "<<day +1 << ", Temperature " << temps + 1 << ": ";
		cin>> tempav[day][temps];
		
	}//end for
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by anamoblu56
0

Hi,
Could you please clear the point. What do you mean by
Day 1 , "Enter High temperature 1: (for column[0]) "
??

0

Hi to you as well.

I am referring to the output that prompts the user to enter values for the first column of my array. (for column [0]) and (for colomn [1] are just references and are not the actual output. I want the output prompt to be specific for each column in my array (of which there are 2). Does that clear things up?

{
	//declare and intilize array
	int tempav[7][2]= {0};
	int tot = 0;
	int average = 0;

	//enter data into array
	
	for(int day = 0; day < 7; day ++)
		for (int temps = 0; temps < 2; temps ++)
	{

		cout<<"Day Number "<<day +1 << ", Temperature " << temps + 1 << ": ";
		cin>> tempav[day][temps];
		
	}//end for
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.