How to correct it , at line 84.

Error executing cl.exe.
error C2447: missing function header (old-style formal list?)

/*---------------------------
Filename : ConflictMatrix.cpp
---------------------------*/

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
using namespace std;

struct student
{
     string studentid;
     vector <int> examcode;	
};

 
int main()

{
    ifstream stream1 ("STA83STU.txt");

    if(!stream1)
{
    cout << "While opening a file an error is encountered" << endl;
}
    else
{
    cout << "File is successfully opened" << endl;
}	
		 
    vector <student> students;
    student aStudent;
    string tempStudentID;
    bool readEntireFile = false;     // set to true when reach end of file
           
    stream1 >> tempStudentID;    //  read in student id of first student
    while (!readEntireFile)
{
    aStudent.studentid = tempStudentID;  //  new student
    int tempExamCode;
    aStudent.examcode.clear ();
    stream1 >> tempExamCode;    // read in first exam code for this student
    aStudent.examcode.push_back (tempExamCode);  // add this exam code to current student's vector of exam codes
            
    bool newStudent = false;   // true when a new student id is encountered
    while (!newStudent && !readEntireFile)  
{
    if (stream1 >> tempStudentID)   // successfully read in student id
{
    if (tempStudentID.compare (aStudent.studentid) == 0)  // student id is same as before
{
    stream1 >> tempExamCode;   // read in exam code
    aStudent.examcode.push_back (tempExamCode); // add this exam code to this student;s vector of exam codes
}
    else
    newStudent = true;   // student id is different from before.  Therefore new student.
}
    else
    readEntireFile = true;  // end of file reached.  Want to exit inner and outer while loops
}  // if new student, do not repeat this while loop

    students.push_back (aStudent);   // no more exam codes for this student.  Add aStudent to students vector
}
    stream1.close ();  // We have read the entire file, so time to close it.
                  
    for (int i = 0; i < students.size (); i++)
{
            
	cout << students.at (i).studentid << endl;   // output student id
    for (int j = 0; j < students.at (i).examcode.size (); j++)
    cout << students.at (i).examcode.at (j) << "\t";   // output list of exam codes for this student
    cout <<"\n"<<endl;       
} 

    return 0; 
}

/*-------------------
Two dimensional array
-------------------*/

{
	const int row = 140;
	const int column = 140;
	float matrix[row][column];

/*------------
creates Matrix
-------------*/
	int num;
    for(int i = 0; i<=row-1; i++)
{
	for(int j = 0; j<=column-1; j++)
{
	infile>>num;
    matrix[i][j]=num;
}
}
	
/*---------------
Prints out Matrix
---------------*/
   
{	cout << "i,j"<<"\t";
	for(int i = 1; i < 140; i++)
{
	cout<<i<<"\t";
}
	cout <<"\n"<<endl;
	for(int j= 1; j < 140; j++)
{
	cout<<j<< "\n";
}

    return;
}
}

Learn to indent in a better way and the answer should be obvious. In the meantime, here's a quick pass through the beautifier.

/*---------------------------
Filename : ConflictMatrix.cpp
---------------------------*/

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
using namespace std;

struct student
{
   string studentid;
   vector <int> examcode;   
};


int main()
{
   ifstream stream1 ("STA83STU.txt");

   if ( !stream1 )
   {
      cout << "While opening a file an error is encountered" << endl;
   }
   else
   {
      cout << "File is successfully opened" << endl;
   }  

   vector <student> students;
   student aStudent;
   string tempStudentID;
   bool readEntireFile = false;     // set to true when reach end of file

   stream1 >> tempStudentID;    //  read in student id of first student
   while ( !readEntireFile )
   {
      aStudent.studentid = tempStudentID;  //  new student
      int tempExamCode;
      aStudent.examcode.clear ();
      stream1 >> tempExamCode;    // read in first exam code for this student
      aStudent.examcode.push_back (tempExamCode);  // add this exam code to current student's vector of exam codes

      bool newStudent = false;   // true when a new student id is encountered
      while ( !newStudent && !readEntireFile )
      {
         if ( stream1 >> tempStudentID )   // successfully read in student id
         {
            if ( tempStudentID.compare (aStudent.studentid) == 0 )  // student id is same as before
            {
               stream1 >> tempExamCode;   // read in exam code
               aStudent.examcode.push_back (tempExamCode); // add this exam code to this student;s vector of exam codes
            }
            else
               newStudent = true;   // student id is different from before.  Therefore new student.
         }
         else
            readEntireFile = true;  // end of file reached.  Want to exit inner and outer while loops
      }  // if new student, do not repeat this while loop

      students.push_back (aStudent);   // no more exam codes for this student.  Add aStudent to students vector
   }
   stream1.close ();  // We have read the entire file, so time to close it.

   for ( int i = 0; i < students.size (); i++ )
   {

      cout << students.at (i).studentid << endl;   // output student id
      for ( int j = 0; j < students.at (i).examcode.size (); j++ )
         cout << students.at (i).examcode.at (j) << "\t";   // output list of exam codes for this student
      cout <<"\n"<<endl;       
   } 

   return 0; 
}

/*-------------------
Two dimensional array
-------------------*/

{
   const int row = 140;
   const int column = 140;
   float matrix[row][column];

/*------------
creates Matrix
-------------*/
   int num;
   for ( int i = 0; i<=row-1; i++ )
   {
      for ( int j = 0; j<=column-1; j++ )
      {
         infile>>num;
         matrix[i][j]=num;
      }
   }

/*---------------
Prints out Matrix
---------------*/

   {  cout << "i,j"<<"\t";
      for ( int i = 1; i < 140; i++ )
      {
         cout<<i<<"\t";
      }
      cout <<"\n"<<endl;
      for ( int j= 1; j < 140; j++ )
      {
         cout<<j<< "\n";
      }

      return;
   }
}

I dont understand....

function main( ) ends at line 77. The code beginning at line 83 is just out there in space. Is it supposed to be another function? If so, it needs a header.

Thank you....I have solved it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.