]Hello guys.!! I have the following code which calculate the average temperature, high temperature, most sunny days etc. So, when i type the value at console it accept it. But when i type -999 to stop and show the cout i take the msg Run-Time Check Failure #3 - The variable *'plithos' is being used without being initialized.* Same with all variables. Here is the code:
As the error states "plithos' is being used without being initialized." Local variables are not default initialized so if you wish for it to start at 0 you must initialize it a value of 0.
Local variables are not default initialized so if you wish for it to start at 0 you must initialize it a value of 0.
You guys spoil all the fun from finding the solution for a problem by yourself...
@OP - Also, nice thing to remember is that static integer is by default set to 0, although static variables also have other features, that might not fit situation.
plithos is the crowd. When i add at cin, the plithos collect every cin.
E.G.
1st cin << therm --> plithos 1
2nd cin << therm --> plihtos 2
3rd cin << therm --> plithos 3
every time i write a value at cin << therm i want plithos to be +1..
If i set my ints 0 all the cout showing 0.
If i use static int shows the msg: Unhandled exception at 0x00F14F99 in Project7.exe: 0xC0000094: Integer division by zero.
You must initialize all your variables or you will have arbitrary numbers when you try to increment and output. I am not exactly sure what your program is supposed to be doing or what you are trying to do. If you could explain in more details what you are attempting to do it would be helpful. I also have no clue as to what any of your variables are so that adds to the confusion.
As far as the next error it is : mesh_therm = therm / mesh_therm; Though this is probably my last response since you are not reading your compiler errors :(
Crucifixflipper - I don't intend to be rude now, so no offence, but do you want to become programmer, or to create programs by yourself? Because if so, you should first think, try to solve the problem, and then ask. Not the other way.
It's really important. Every time I encounter a problem, I try to fix it. I do it for so long, that I lose hope of solving it. Then I try to solve it few more minutes, and if I fail, i write long, exhausting note about what the problem is, dependencies that may be causing the problem, and what I think problem could be. 90% of time, when I'm describing problem really precisely, then at some moment I find the place with bug.
@topic - Whatever you're saying about plithos, it doesn't look right. If you want to do what you just said(increase plithos by 1 after cin), then your code is almost okay; but remember, that all variables have to be initialized, before you use them!
And your latter error only showed, that now you've solved one problem, and got another.
First try to run program in your head; execute each step. If you don't find the mistake, try the method I described earlier.
Good luck!