I need to make a program that asks for how many days there are in a particular month, and then ask for the minimum and maximum temperature for each of the days.
So now i'm wondering how i'm supposed to make it ask for the temperature of exactly 30 days, and not 28 or 29 or 31, if it's 30 that i've entered.
I don't know how clear i made myself there, but i hope someone can help me out :)
(i'm not asking anyone to write everything for me, but to just point me in the right direction)
Thanks!
have you got any code so far? post what you have, and we can try to help.
Also, do you really want to specify how many days are in the month, or would you like to just specify which month and have it automatically know number of days (with perhaps exception of having to ask if it's leapyear or not for feburary)?
You can hard code an array to contain that information.
I don't really have any code yet. But what i was thinking is that there's gotta be an easier way to fill in the temperatures than what i've thought of, which is to make an int for every temperature (if that would work at all).
int mintemp1, mintemp2, mintemp3, mintemp4, mintemp5, mintemp6, mintemp7;
int mintemp8, mintemp9, mintemp10, mintemp11, mintemp12, mintemp13, mintemp14;
int mintemp15, mintemp16, mintemp17, mintemp18, mintemp19, mintemp20;
int mintemp21, mintemp22, mintemp23, mintemp24, mintemp25, mintemp26;
int mintemp27, mintemp28, mintemp29, mintemp30, mintemp31;
And the program should then ask me to fill in the temp. for the number of days that i type in, and forget about the rest of the ints/days.
This is not how you would do it, right?
And yes, i have to specify the number of days, not just bringing up some pre-made calendar.
Ok, i've discovered that i don't really need to store every temperature that i enter. It's enough that i just add them all together and divide on the number of days (i need to find the average temperature). So i won't need all those ints.
What i need to find out now is how to make it ask for the temperature for only the entered number of days. You know, if i enter 28, then i will have to enter 28 temps.
I'm guessing that a for-loop is needed here?
I tried putting something together (this actually seems to work as intended):
Also, i'm supposed to use consts for the max and min temperatures, instead of hard coding them everywhere like i've done here. But i don't understand why and how i'm supposed to use it, since they are a range from -70 to 70, and not a single number. Any ideas?