Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » C programming problem~~~~~~
Closed Thread
Old 07-12-2004, 05:07 AM   #1 (permalink)
 
Ultra Techie

Join Date: May 2004

Posts: 827

didi

Default C programming problem~~~~~~

Is there any1 can help me solve this question using C language?

You are developing a database of measured meteorological data for use in weather and climate research. Define a structure type measured_data_t with components site_id_num (a four-digit integer), wind_speed, day_of_month, and temperature. Each site measures its data daily, at noon local time. Write a C program that inputs a file of measured_data_t records and determines the site with the greatest variation in temperature (defined here as the biggest difference between extrema) and the site with the highest average wind speed for all the days in the file. You may assume that there will be at most ten sites. Test the program on the following July daily data collected over one week at three sites:

ID Day Wind Speed (knots) Temperature (deg C)
2001 10 11 30
2001 11 5 22
2001 12 18 25
2001 13 16 26
2001 14 14 26
2001 15 2 25
2001 16 14 22
3345 10 8 29
3345 11 5 23
3345 12 12 23
3345 13 14 24
3345 14 10 24
3345 15 9 22
3345 16 9 20
3819 10 17 27
3819 11 20 21
3819 12 22 21
3819 13 18 22
3819 14 15 22
3819 15 9 19
3819 16 12 18
__________________
http://blog.diyersitzone.net/

AMD Athlon 64x2 4000+
2GB Kingston DDRII667Mhz
MSI K9Neo-F
MSI 256MB GeForce8500GT
Western Digital 160GB SATAII HDD
Maxtor 80GB 8M ATA133 HDD
LG 4163B DVDRW
17" Samsung 793Dfx Monitor
Win XP Pro
didi is offline  
Old 07-14-2004, 07:39 PM   #2 (permalink)
 
True Techie

Join Date: Apr 2004

Posts: 168

nak-1

Default

Without doing it for you you could take the following approach:

Define an array of structures with suitable member variables.

Initialise ten of these arrays so you have something to put the data for each site into.

write a function to read the data from a text file and fill the appropriate amount of arrays with data for each site in the test data.

You will definately need to keep track of the amount of sites that you have in your data.

You will want another array of structures to keep information about each site that you derive from the data, probably max temp variation and average wind speed.

write a function to work out the average wind speed for a site from its data, count the number of records, sum the windspeeds, divide...

write a function to work out the difference between the max and min temperature for a site, you could step through the array item by item filling to variables min and max if the current value is smaller or greater than the previous one respectively. then subtract the min from the max.

write a function to call these two functions for a site and store the results in the appropriate data structure.

write a function to interrogate the data structure of results and return the site ID with the maximum temperature variation and the highest average wind speed.

write a main function to call the others at the appropriate time and manage the looping through the data. Have it display the relevant information at the end.
__________________
--------------------

Nak

Is it just me, or does something smell suspicious about all this?
nak-1 is offline  
Old 07-16-2004, 04:24 AM   #3 (permalink)
 
Ultra Techie

Join Date: May 2004

Posts: 827

didi

Default

thx for your concept, at least i know start from where.
__________________
http://blog.diyersitzone.net/

AMD Athlon 64x2 4000+
2GB Kingston DDRII667Mhz
MSI K9Neo-F
MSI 256MB GeForce8500GT
Western Digital 160GB SATAII HDD
Maxtor 80GB 8M ATA133 HDD
LG 4163B DVDRW
17" Samsung 793Dfx Monitor
Win XP Pro
didi is offline  
Old 07-18-2004, 11:13 AM   #4 (permalink)
 
True Techie

Join Date: Apr 2004

Posts: 168

nak-1

Default

let us know how you get on!
__________________
--------------------

Nak

Is it just me, or does something smell suspicious about all this?
nak-1 is offline  
Old 12-10-2006, 10:18 PM   #5 (permalink)
 
Newb Techie

Join Date: Dec 2006

Posts: 2

pwscottiv

Default Re: C programming problem~~~~~~

Did you ever finish this problem?
Quote:
Originally posted by didi
Is there any1 can help me solve this question using C language?

You are developing a database of measured meteorological data for use in weather and climate research. Define a structure type measured_data_t with components site_id_num (a four-digit integer), wind_speed, day_of_month, and temperature. Each site measures its data daily, at noon local time. Write a C program that inputs a file of measured_data_t records and determines the site with the greatest variation in temperature (defined here as the biggest difference between extrema) and the site with the highest average wind speed for all the days in the file. You may assume that there will be at most ten sites. Test the program on the following July daily data collected over one week at three sites:

ID Day Wind Speed (knots) Temperature (deg C)
2001 10 11 30
2001 11 5 22
2001 12 18 25
2001 13 16 26
2001 14 14 26
2001 15 2 25
2001 16 14 22
3345 10 8 29
3345 11 5 23
3345 12 12 23
3345 13 14 24
3345 14 10 24
3345 15 9 22
3345 16 9 20
3819 10 17 27
3819 11 20 21
3819 12 22 21
3819 13 18 22
3819 14 15 22
3819 15 9 19
3819 16 12 18

pwscottiv is offline  
Old 12-11-2006, 03:12 PM   #6 (permalink)
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default

Considering that post is from July of 2004, he's probably a C guru by now.
__________________
Vormund is offline  
Old 12-11-2006, 03:25 PM   #7 (permalink)
 
Newb Techie

Join Date: Dec 2006

Posts: 2

pwscottiv

Default

Quote:
Originally posted by Vormund
Considering that post is from July of 2004, he's probably a C guru by now.
Yeah, I noticed that, but I figured I give it a shot anyway...
pwscottiv is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On