|
|
Subject:
The Open University course T223 TMA 4 Q3 in full
Category: Computers > Programming Asked by: reebok-ga List Price: $20.00 |
Posted:
19 Sep 2002 14:58 PDT
Expires: 19 Oct 2002 14:58 PDT Question ID: 67020 |
I have started, but would like it all. But is someone can help with why I get a compiler error, Statment missing ; in fuction. On line 404. See below. /* * function tms_calculate_max() * ============================ * This function returns the index in TemperatureLog[] * of the maximum of the stored temperature readings. */ int tms_calculate_max(float *data, int number) { int i, max_index; float max_data; max_data = data[1]; max_index = 0; for (i=0; i < number; i++) { If (max_data < data[i]) (line 404) { max_data = data[i]; max_index = *data[i]; data[i]++; } } return (max_index); } /* * end of tms_calculate_max() */ |
|
Subject:
Re: The Open University course T223 TMA 4 Q3 in full
Answered By: rbnn-ga on 19 Sep 2002 15:06 PDT Rated: |
You are getting a compiler error for this program because the line: If (max_data < data[i]) should read: if (max_data < data[i]) By the way, I was not quite sure if you just wanted the answer to this one question, or if you wanted an entire course. If the latter, I can retract this answer. | |
|
reebok-ga
rated this answer:
Thank you, but yes I was hoping for the whole TMA question to be answered,but a bit tricky to reproduce on here. You solution did work for that problem but did through up another. Illegal use of floating point line 406. I will try and express the question a bit further, but there is a flow chart, which I will try and put into words. Local variables: i for loop counter, max_data for the running maximum temperature, max_data for the array index of the running maximum temperature, data[] for the array containig the floating point temperatures, number for the number of readings stored in the data[] array. Start - Set max_data to the first temperature reading - Set max_index to zero - Set array index to zero - All readings tested? - Yes - Return max_index - No --- Is reading > max_data ? - No - Increment array index (return to all readings tested?) - Yes - max_data = reading - max_index = array index of reading(which was what I was trying to do in line 406) - Increment array index (return to all readings tested?, in the flow chart). I have never used google answer before and not sure if I am compling by puting this hear any advice welcome. |
|
There are no comments at this time. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |