   warning C4700: uninitialized local variable 'min and max' used,
  well first of all i was having a problem with a few errors but i have gotten them fixed in the mhgean time but no it come to the warnings that i am getting using local variables, but so far my program compiles successfully but i keep getting the following warnings and i cant seem to find whats wrong with them.If someone could help i would greatly appreciate it and i am also getting a runtime error also from this matter but here are the warnings that i am getting.warning C4700: uninitialized local variable 'min' usedwarning C4700: uninitialized local variable 'max' usedso here is my source code for you to look at and reference to if need be// Author:James M. Neal// Assignment: CIS 251 Assignment 4// File:  assign4.cpp// Purpose:    Searches a file of numbers of type int and writes the largest and//   smallest numbers to the screen. Allows the user to repeat action//   with other files.//   and allows you to find the average of the class of numbers and outputs them to the screen.// Input: Name of file to be processed. Class1.txt, Class2.txt, Class3.txt, and Class4.txt#include <iostream>#include <fstream> // I/O#include <iomanip> // For setw()using namespace std;ofstream outputfile("output.txt");const int MAX_FILE_NAME = 35; // Maximum space allocated for file namevoid open_input(ifstream& input, char name[]);// Get file name & Open filevoid find_max_min(ifstream& input, int& max, int& min); // Find max & min valuesdouble find_average(ifstream& input); // Finds averagevoid output(const char name[], int max, int min, ostream& os = cout); // Print resultsint main() // Parameters: None// Returns:    Zero// Calls: open_input(), find_max_min(), output(){  char again;    // Does user want to go through loop again?   char file_name[MAX_FILE_NAME + 1]; // Name of file to be processed   ifstream input_numbers;  // For working with input file   int max; // Maximum and minimum numbers from file   int min;   double average;   cout << "This program can find the largest and smallest numbers in a file\n"   << "of integers.\n" << endl;   system("pause"); // Hold message on screen until key is pressed   do    {   system("cls");  // Clear screen open_input(input_numbers, file_name);    // Get file name & open file  // find_max_min(input_numbers, max, min);   // Find max & min values in fileaverage =  find_average(input_numbers);  input_numbers.close();    // Close file output(file_name, max, min);  // Print results on screen output(file_name, max, min, outputfile);    // Print results on outputfile cout << "\nDo you want to process another file (Y/N)? "; cin >> again; cin.ignore(256, '\n');  // Remove Enter key from keyboard buffer } while ( again == 'y' || again == 'Y');    cout << "\nEnd of Program!" << endl;   outputfile << "\n\nThanks for using MaxMin!\f";    outputfile.close(); return 0; }  // End of main()void open_input(ifstream& input, char name[]) //Open file, exit on error// Parameters: Variables for input file reference and input file name// Returns:    None// Calls: None{  int count = 0;   // a count number of tries do // Continue until we get a valid file name and can open file   {   count++;  if (count != 1)  // Issue error message if we are trying again. {  cout << "\n\aInvalid file name or file does not exist. Please try again."<< endl; }    cout << "\nEnter the input file name (maximum of " << MAX_FILE_NAME << " characters please)\n:> "; cin.get(name, MAX_FILE_NAME + 1);// Gets at most MAX_FILE_NAME characters cin.ignore(256, '\n'); // Remove Enter key from keyboard buffer  input.clear();    // Clear all error flags, if any, from prev try input.open(name, ios_base::in); // Open only if file exists } while (input.fail() );  // If can't open file, try again} // End of open_input()void find_max_min(ifstream& input, int& max, int& min) // Find max & min values// Parameters: Variables for file reference and max and min values// Returns:    None// Calls: None{int value;    // Value from file   input >> value;    // Reads first value   max = min = value; // Initialize max & min to first number   while (input >> value)  // Continue as long as we can read a number from file.   {   if (value > max) max = value; if (value < min) min = value;   }} // End of find_max_min()double find_average(ifstream& input)// Parameters: Variables for file reference and max and min values// Returns:    None// Calls: None{  double value= 0;    // Value from file  double sum = 0;  int count= 0;  // Initialize max & min to first number   while (input >> value)  // Continue as long as we can read a number from file.   {   sum += value;  count++;   }   return sum/count;}void output(const char name[], int max, int min, ostream& os) // Print results// Parameters: File name, max & min values from file, output stream// Returns:    None// Calls: None{  os << "\n\nInput File Name   : " << name << endl;   os << "Largest Number in File : " << setw(8) << max << endl;   os << "Smallest Number in File: " << setw(8) << min << endl;} // End of output()also the runtime error is the following:Run-Time Check Failure #3 - The variable 'min' is being used without being defined.Run-Time Check Failure #3 - The variable 'max' is being used without being defined.thanks for any help that i can get[edit: source tags are your friend -SiCrane]   
  The computer is telling you what the problem is. You have variables max and min and you're trying to use them without have first given them some value. The fix is to give them some value before you use them.   ;  Since you commented the call to find_max_min, variable max and min was not initialized with any value, so they have just random values in them, this is what the warning trying to say.   ;  The call to find_max_min() is commented out, so min and max are never set before you try to write them in the output() function.   ;  but how would i need to fix this problem and what should i do to solve the runtime errors also cause i am trying to find the average of a set of number in a text file that i have created   ;  SiCrane told you the answer, just give them some initial values, like 0.   ;  when i give them a value of zero my answer is returned as zero so i have tried the following:max !=0 min!=0 when i try this i get several errors that produce after that is initialized what should be done to prevent this from happening   ;  Uncomment this line if you wish to find the max and min value:// find_max_min(input_numbers, max, min);   // Find max & min values in file;  when i do that my program will not build correctly after that line is uncommented so what should be done for it to link orrectly after the line is uncommented   ;  You fix it, by fixing the error that the compiler or linker gives you when the program does not build correctly.Also, we don't do homework on this forum. Specific, directed questions like your original post are sometimes acceptable, but at this point you are not demonstrating to me any sort of initiative in solving your own problem. Please read this.Closed.   