1. Member
Join Date
Dec 1969
Posts
58

I have been struggling with this prob..but nothing seems to work.<BR><BR>Here is my problem: I am working on a weather project where I have to display the "highest" and "lowest" temp for that week.<BR>For eg: I have values like SunH=90,MonH=50..so on now I have to display 90 and the same for the lowest.<BR>This is my Code.. But nothing seems to work.. <BR>Dim maxvalue<BR>maxvalue=120<BR>Dim iHighs(6), iLows(6) <BR>iHighs(0) = SH<BR>iLows(0) = SL<BR>iHighs(1) = MH<BR>iLows(1)=ML<BR>iHighs(2) = TH<BR>iLows(2)=TL<BR>iHighs(3) = WH<BR>iLows(3)=WL<BR>iHighs(4) = THH<BR>iLows(4) = THL<BR>iHighs(5)=FH<BR> iLows(5) = FL <BR>iHighs(6) = SH<BR>iLows(6) = SL<BR>iHigharray=array(int(SH),int(MH),int(TH),int (WH),int(THH),int(FH),int(SAH))<BR>for iCount=1 to ubound(iHigharray )<BR>if (iCount) &#062; maxvalue then <BR>maxvalue = iHigharray(iCount) <BR>end if<BR>Next<BR><BR>Thanks<BR>Poppy<BR>

2. Senior Member
Join Date
Dec 1969
Posts
935

build an array, it slength will be 7 (because you have 7 days in a week) and you&#039;ll know that the first value will be for sunday, the second for monday and so on...<BR>now enter to each part of the array only the temp (so it will be a number) and now search the array for the highest (or lowest) value, something like this:<BR>tempArr = Array(10,20,40,10,50,20,30)<BR>highTemp = tempArr(0)<BR>lowTemp = tempArr(0)<BR>for iCount = 1 to UBound(tempArr)<BR>if tempArr(iCount) &#062; highTemp then<BR>highTemp = tempArr(i)<BR>end if<BR>if tempArr(iCount) &#060; lowTemp then<BR>lowTemp = tempArr(i)<BR>end if<BR>Next

3. Member
Join Date
Dec 1969
Posts
58

Dim iHighs(6), iLows(6) <BR>These are my two arrays <BR> <BR>tempArr = Array(SH,MH,TH,WH,THH,FH,SATH) <BR>in the array where you have given the nos i have put the requested values of temp stored in the variables.. then followed the logic u posted..<BR>But it just outputs 0

4. Senior Member
Join Date
Dec 1969
Posts
935

## code?

what is the value of:<BR>SH,MH,TH,WH,THH,FH,SATH???<BR>numbers??? or string/char?<BR>and are you sure that they are not all 0?<BR>and the output of what is 0? maxTemp? or lowTemp?

5. Member
Join Date
Dec 1969
Posts
58

## RE: code?

they are all the "High" temps requested form the first file.<BR>the out put of max temp is displayed as 0 ..

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•