Thermometer Programming Software Development by Hamilton89 I'm trying to make a thermometer that can show when the temperature goes out of the … Re: Thermometer Programming Software Development by Hamilton89 … you with this. first, i'm trying to get the thermometer to display how many times the degrees goes below 17… Re: Thermometer Programming Software Development by Moschops [CODE]while(random_temp != 17,18,19,20,21,22,23,24)[/CODE] That's just plain wrong. I suspect you meant: [CODE]while(random_temp != 17 && random_temp != 18 && random_temp != 19 && random_temp != 20 && random_temp != 21 && random_temp != 22 && random_temp != 23 &… Re: Thermometer Programming Software Development by mikrosfoititis First of all you need to get rid of the while loops in your if and else if statement: [CODE] if (( random_temp >= 12 || random_temp < 17 )) { [COLOR="red"]while( random_temp >= 12 || random_temp < 17 ) {[/COLOR] cout <… Re: Thermometer Programming Software Development by mikrosfoititis [QUOTE=Moschops;1710468][CODE]while(random_temp != 17,18,19,20,21,22,23,24)[/CODE] That's just plain wrong. I suspect you meant: [/QUOTE] My compiler accepts that... I thought it was wrong too, but when I tested it I didn't got any errors :S Re: Thermometer Programming Software Development by Moschops It's not incorrect syntax. It's just not at all what he meant to do. The "," operator separates a group of expressions that are evaluated from left to right, so in this case [B](random_temp != 17,18,19,20,21,22,23,24)[/B] [B]random_temp != 17[/B] is evaluated, maybe true, maybe false, and then.... [B]18[/B] is evaluated. It's 18. The … Re: Thermometer Programming Software Development by mikrosfoititis The code is faulty and badly structured. Here's an example of what you want to do: [CODE] for(index = 1; index <= 40; index++) { random_temp = lowest+int(range*rand()/(RAND_MAX + 1.0)); if(random_temp < 17) count_low++; //Declare count_low at the beginning as "int count_low = 0;" else if(random_temp > 24) … Re: Thermometer Programming Software Development by Hamilton89 [QUOTE=mikrosfoititis;1710983]Now about the minutes, I'm not sure of what you mean exactly.[/QUOTE] thnks very much mikro, that has tidied up my code alot and works well, however it shows the answer 3.21387e-039 every time i run it and i have declared the variable as = to 0 so that it wouldnt pick any umber stored in memory Re: Thermometer Programming Software Development by Moschops 3.21387e-039 [I]is[/I] zero. Time to learn about floating point numbers: [url]http://floating-point-gui.de/[/url] Re: Thermometer Programming Software Development by Hamilton89 i declared the variables above_temp and below_temp as 0 and the answer then is 0, im not sure where exactly im making the mistake moschops, and that should resolve the floatig point number shouldnt it? [CODE] #include <iostream> #include <cmath> using namespace std; { float index; float random_temp = 0;… Re: Thermometer Programming Software Development by mikrosfoititis [CODE] if(random_temp < 17) { float below_temp = 0; //What is this? below_temp++; } else if(random_temp > 24) { float above_temp = 0; //Again...? above_temp++; } [/CODE] No! You don't want to initialise … Re: Thermometer Programming Software Development by Moschops [QUOTE]and that should resolve the floatig point number shouldnt it?[/QUOTE] What should resolve the floating point number? Which floating point number? What do you mean "resolve"? Re: Thermometer Programming Software Development by Hamilton89 [QUOTE=mikrosfoititis;1711223]No! You don't want to initialise the variables again within the ifs! This way you will never get the correct value! And there is no point in using [ICODE]float[/ICODE] type because a count of times is always an integer.[/QUOTE] oh right, thats where i've been going wrong, my lecturer told me to always initialise … Re: Thermometer Programming Software Development by Hamilton89 i meant moschops that by changing it shoul it not fix my code and make it run properly by initialising the variable, but obviously i was wrong because when i do so, it just gives me the answer of 0 Re: Thermometer Programming Software Development by mikrosfoititis [QUOTE=Hamilton89;1711248]i change it the way you said and now the values are temp below = 2293496 ad temp above = 4247312[/QUOTE] They shouldn't if you only initialised the variables at the beginning of main to zero. But only at the very beginning of main, n-o-w-h-e-r-e else. Re: Thermometer Programming Software Development by Hamilton89 [QUOTE=mikrosfoititis;1711256]They shouldn't if you only initialised the variables at the beginning of main to zero. But only at the very beginning of main, n-o-w-h-e-r-e else.[/QUOTE] thats what i have done, only in int main i initialised everything, i've posted the entire code im using to show you what ive done [CODE]#include <iostream&… Re: Thermometer Programming Software Development by mikrosfoititis OK, things are getting a little bit mixed up. Variables have scopes. To put it simple, variables declared in different functions can't "see" each other. They also live as long as the function is executed. You declare and initialise variables within the function they will have a meaning and purpose, thus are going to be used to do … Re: Thermometer Programming Software Development by Hamilton89 ye im sorry about that, em im after doing that and the answer still shows up as 2293496 and 4247328 have you run this in your own compiler and its worked? Re: Thermometer Programming Software Development by Hamilton89 i got the code to work, my problem was that i needed to declare count_low outside of the for loop so by making count_low = count_low it worked when i used the cout function [CODE] cout << " Temperature Vaules " << endl; for(index = 1; index <= 40; index++) { random_temp = lowest+int(range*… Re: Thermometer Programming Software Development by mikrosfoititis [CODE] count_low = count_low; // by making count_low = count_low this gets rid of floating point numbers and makes it visible outside of the for loop count_high = count_high; // similarly with count_high [/CODE] Ok, can anybody see the point at this? is there thermometer jquery or js script ? Programming Web Development by peter20 Hi, I would like to add to my sita a thermometer. I have an input box and I think it would …be nice if user could see the thermometer next to his input. When user lets the input box… the thermometer to be updated. Does anybody know how can I do… AS3 thermometer Programming Mobile Development by Cronicle8 Hello everyone, I am trying to create a thermometer, i do have an idea of how to make it, not sure if it is correct, but here it goes: I have an image of a thermometer, and i would apply a mask(Rectangle), and it's width and X would vary. I'm not sure how to apply this in the form of code, any help? Re: AS3 thermometer Programming Mobile Development by Cronicle8 I think i will have to use a Thermometer picture, and then a movie clip or some sort. Question being how can i achieve that. The language is AS3. Re: AS3 thermometer Programming Mobile Development by Ab000dy_85 > AS3 [here is a link by Adobe about rectangles, you might need to use 2 of those to draw a thermometer](http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7dc9.html) Code for a fundraising thermometer Programming Web Development by jelly46 Can anyone help? I am looking for code for a fundraising thermometer. I have looked and looked and looked. I need it to be html and js Can point me in the right direction. Re: AS3 thermometer Programming Mobile Development by Ab000dy_85 what language are you using, I have done this once in Java, but not as AS3 Style. if you use graphic interface class in C# it will work easy Re: Code for a fundraising thermometer Programming Web Development by pritaeas Google showed this (amongst many others): http://educ.jmu.edu/~johns2ja/fundraisingthermometer.html Problem with Paint Event Programming Software Development by OldQBasicer …33 TimeNow = DateTime.Now TimeLater = DateTime.Now 'Draw column of thermometer in blue g.DrawRectangle(Pens.Blue, 410, 40, 10, 350… so fill covers parts _ 'of shapes 'Fill column of thermometer with red g.FillRectangle(Brushes.Red, 411, intFillTop, 8, … Paint Event Programming Software Development by OldQBasicer … TimeLater = DateTime.Now 'Draw column of thermometer in blue e.Graphics.DrawRectangle(Pens.Blue,…'Dim intCurrentTemp As Integer = 0 'Make thermometer go up each second For t = 1 … parts of shapes 'Fill column of thermometer with red e.Graphics.FillRectangle(Brushes.Red… Help With Paint Event Programming Software Development by OldQBasicer … TimeLater = DateTime.Now 'Draw column of thermometer in blue e.Graphics.DrawRectangle(Pens.Blue,…'Dim intCurrentTemp As Integer = 0 'Make thermometer go up each second For t = 1 … parts of shapes 'Fill column of thermometer with red e.Graphics.FillRectangle(Brushes.Red…