assgn5/yassign5.cpp
void write_output(string outputfilename, student student_particulars[]) {
	
	// Create output file stream
	ofstream outputfile;
	/**
	 * Convert outputfilename to string in C so that the file I/O function
	 * in the C++ library can be utilised
	 */
	outputfile.open(outputfilename.c_str());
	// Assertion to check if the output file was opened properly
	if(outputfile == NULL) {
		cout << "Output file, with the filename " << outputfilename
			<< ", does not exist!" << endl;
	}
	
	
	// Left align the data
	outputfile.setf(ios::left);
	// Print the student records
	for(int i=0; i<number_correct_records; i++) {
		outputfile.width(16);
		outputfile << student_particulars[i].last_name;
		outputfile.width(16);
		outputfile << student_particulars[i].first_name;
		outputfile.width(16);
		outputfile << student_particulars[i].social_security_number;
		outputfile.width(16);
		outputfile << student_particulars[i].phone_number;
		outputfile.width(16);
		outputfile << student_particulars[i].age;
	}
	outputfile << endl;
	
	// Close the output filestream
	outputfile.close();
}
/**
 * Function to write output to a file
 * #Print the particulars of each student in a line with the following format:
 *	Last_name	First_name	Social_Security_Number	Telephone	Age
 * @param outputfilename is the name of the output file
 * @param student student_particulars contains a table of students' particulars
 */
Function to write output to a file
#Print the particulars of each student in a line with the following format:
Last_name       First_name      Social_Security_Number  Telephone       Age
@param outputfilename is the name of the output file
@param student student_particulars contains a table of students' particulars
Function to write output to a file #Print the particulars of each student in a line with the following format : Last_name First_name Social_Security_Number Telephone Age @param outputfilename is the name of the output file @param student student_particulars contains a table of students ' particulars
void write_output(string outputfilename, student student_particulars[]) {
	ofstream outputfile;
	outputfile.open(outputfilename.c_str());
	if(outputfile == NULL) {
		cout << "Output file, with the filename " << outputfilename
			<< ", does not exist!" << endl;
	}
	outputfile.setf(ios::left);
	for(int i=0; i<number_correct_records; i++) {
		outputfile.width(16);
		outputfile << student_particulars[i].last_name;
		outputfile.width(16);
		outputfile << student_particulars[i].first_name;
		outputfile.width(16);
		outputfile << student_particulars[i].social_security_number;
		outputfile.width(16);
		outputfile << student_particulars[i].phone_number;
		outputfile.width(16);
		outputfile << student_particulars[i].age;
	}
	outputfile << endl;
	outputfile.close();
}
void write_output ( string outputfilename , student student_particulars [ ] ) { ofstream outputfile ; outputfile . open ( outputfilename . c_str ( ) ) ; if ( outputfile == NULL ) { cout << " " << outputfilename << " " << endl ; } outputfile . setf ( ios :: left ) ; for ( int i = 0 ; i < number_correct_records ; i ++ ) { outputfile . width ( 16 ) ; outputfile << student_particulars [ i ] . last_name ; outputfile . width ( 16 ) ; outputfile << student_particulars [ i ] . first_name ; outputfile . width ( 16 ) ; outputfile << student_particulars [ i ] . social_security_number ; outputfile . width ( 16 ) ; outputfile << student_particulars [ i ] . phone_number ; outputfile . width ( 16 ) ; outputfile << student_particulars [ i ] . age ; } outputfile << endl ; outputfile . close ( ) ; }
Function to write output to a file
 #Print the particulars of each student in a line with the following format:
      Last_name       First_name      Social_Security_Number  Telephone       Age
 @param outputfilename is the name of the output file
 @param student student_particulars contains a table of students' particulars
Function to write output to a file #Print the particulars of each student in a line with the following format : Last_name First_name Social_Security_Number Telephone Age @param outputfilename is the name of the output file @param student student_particulars contains a table of students ' particulars
// Create output file stream /**
	 * Convert outputfilename to string in C so that the file I/O function
	 * in the C++ library can be utilised
	 */ // Assertion to check if the output file was opened properly // Left align the data // Print the student records // Close the output filestream