Note that there are some explanatory texts on larger screens.

plurals
  1. POwarning C4700: uninitialized local variable
    primarykey
    data
    text
    <p>When I compile it says "warning C4700: uninitialized local variable 'count' used". I am not sure why it is saying this and I did not come on here so someone can do my homework. just looking for help with this one error, I know it has to do with the function definition ReadStudentData or in Main.</p> <p>thanks</p> <pre><code>#include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt; using namespace std; struct StudentType {string studentName; int testScore;//Between 0 and 100 char grade; }student[20]; void PrintNameHeader(ostream&amp; out); bool OpenInputFile(ifstream&amp; inFile, string&amp; infilename ); //OPEN input file void Pause();// Pause void ReadStudentData(ifstream&amp; infile, StudentType student[], int&amp; );// Read student infp including first and last name and test score void AssignGrades(StudentType student[], int);//assign grades to each student int HighestScore(const StudentType student[], int );//Get the highest scores void PrintNamesWithHighestScore(const StudentType student[], int);//Print name with highest Scores void DisplayAllStudents(const StudentType student[], int);//Display all students void GetLowHighRangeValues(int&amp; , int&amp;);//for example a student types 50 100 , it will get all students within that range void DisplayStudentsInRange(const StudentType student[], int, int, int);// display students in that range void SortStudentsByName(StudentType student[], int);// sort students by name void SortStudentsByScore(StudentType student[], int);// sort students by test score highest to lowest const int NUM_STUDENTS = 20; int main() { ifstream infile; string inFilename; int count = 0; StudentType student[NUM_STUDENTS]; int numStudents; PrintNameHeader(cout); OpenInputFile(infile,inFilename); ReadStudentData(infile, student, numStudents); AssignGrades(student, numStudents); return 0; } //Function definitions void PrintNameHeader(ostream&amp; out) { //Display name header on screen cout &lt;&lt; "name" &lt;&lt; endl; } bool OpenInputFile(ifstream&amp; inFile, string&amp; infilename) { cout &lt;&lt; "Enter the name of the .txt file that you want to open for input.\n"; cout &lt;&lt; "Do not put spaces in the file name "; cin &gt;&gt; infilename; cout &lt;&lt; endl; inFile.open(infilename.c_str()); if (inFile.fail()) { cout &lt;&lt; "Sorry, the input file " &lt;&lt; infilename &lt;&lt;" was not found"&lt;&lt; endl;\ return false; } cout &lt;&lt; "Input file " &lt;&lt; infilename &lt;&lt; " is open for reading.\n\n"; return true; } void Pause() { cout &lt;&lt; endl; cin.ignore(80, '\n'); cout&lt;&lt;"Please hit the enter key to continue...\n"; cin.get(); } void ReadStudentData(ifstream&amp; infile, StudentType student[], int&amp; numstudents) { string firstName, LastName, testScore; int count = 0; if( infile) for (int count; count &lt; NUM_STUDENTS; count++) { cin &gt;&gt; firstName[count] &gt;&gt; LastName[count] &gt;&gt; testScore[count]; student[count].studentName = firstName + ", " + LastName; } numstudents = count; cout &lt;&lt; numstudents &lt;&lt; endl; } void AssignGrades(StudentType student[], int numstudents) { int i; for(i=0;i&lt; NUM_STUDENTS;i++) switch((int)(student[i].testScore/10)) {case 10: case 9: student[i].grade='A'; break; case 8: student[i].grade='B'; break; case 7: student[i].grade='C'; break; case 6: student[i].grade='D'; break; default: student[i].grade='F'; break; } } int HighestScore(const StudentType student[], int numstudents) { int max=0,i; for(i=1;i&lt;numstudents;i++) { if(student[i].testScore&gt;student[max].testScore) max=i; } return max; } void PrintNamesWithHighestScore(const StudentType student[], int numstudents) { } void DisplayAllStudents(const StudentType student[], int numstudents) { } void GetLowHighRangeValues(int&amp; lowRange, int&amp; highRange) { } void DisplayStudentsInRange(const StudentType student[], int numStudents, int lownum, int highNum) { } void SortStudentsByName(StudentType student[], int numStudents) { } void SortStudentsByScore(StudentType student[], int numstudents) { } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload