Help me with my C++ Program!!!

May 31, 2014 at 8:12am
hey guys. I am having trouble to do a C++ program. Can someone help me get to a start which I can then follow up on. Basically, the program has to give the user a reading when the user enters the date, time and their bearing. The reading will be the temperature at that place and that time. Can Someone please help?
ill include what the table looks like.
THANK YOU!!!!!!!!
http://i34.photobucket.com/albums/d134/puffingfatman/20140531_161333_zps2d0926f5.jpg
Last edited on May 31, 2014 at 8:24am
May 31, 2014 at 1:24pm
You can put all the data into an array:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const int NumDays = however_many_days_you_have;
int readingTable[NumDays][24][5] = {
	{ // Jun 23
		{80, 87, 76, 109, 75},    // 12am
		{144, 164,147, 153, 141}, // 1am
		{141, 160, 144, 147, 137}, // 2am
		...
		{82, 87, 77, 110, 76},   // 11pm
	},
	{ // Jun 24
		{ 77, 60, 54, 71, 58},    // 12 am
	etc.
	}
};

Note that I've assumed the "12am" column in the table is actually the hour at the beginning of the day. If I'm wrong then just change the order.

Next you will need to get the data from the user:
1
2
3
4
5
6
7
int daysSinceJun23;
int hoursSinceMidnight;
enum Bearing {North, South, East, West, Central};
Bearing bearing;

// get the days since Jun 23, the hours since midnight and the bearing
// from the user and set the variables accordingly. 

Once you have all this, the reading is simple:
 
int reading = readingTable[daysSinceJun23][hoursSinceMidnight][bearing];

Jun 8, 2014 at 4:45am
alright thanks mate! really helped a lot! Will try to show my progress soon!

Topic archived. No new replies allowed.