what do these errors mean?

Run-Time Check Failure #3 - The variable 'temperature' is being used without being initialized.
Run-Time Check Failure #3 - The variable 'negative' is being used without being initialized.

This is my program:

#include <fstream>
#include <iostream> //This is for input and output of the file
#include <string>

using namespace std;

const string stars = "*";
const string line = "|";
int main()

{
int count;
float temperature;
string fileName;
float negative;
float positive;


cout << ("Enter file name: ");
getline(cin, fileName);


if(temperature == negative)
{
cout << "Can not open the input file" << endl;
return 1;
}

if(temperature == positive)

temperature= 0;
while(temperature <= 120)
{
count = 0;
while(count <= temperature);}
{
cout << '*';
count++;

temperature++;}

cout << endl;
return 0;
}
The error messages say it all.
1
2
3
4
5
if(temperature == negative)
{
cout << "Can not open the input file" << endl;
return 1;
}

Not only are you using uninitialized variables, but the message can't possibly be related to the condition being checked.
Last edited on
Ok...This is only my second program to ever write. If I don't ask for help then how will I know what to do or what I am doing wrong.
Thanks
No one ever told you not to ask for help.

But yes, you're using variables that you haven't set to any value. And your error message makes no sense because you're checking if temperature equals negative, and I think you meant to check if temperature < 0. Also, you will never see the error message because the program immediately quits.
Topic archived. No new replies allowed.