1

PHOTO EMBED

Tue Apr 27 2021 00:51:21 GMT+0000 (Coordinated Universal Time)

Saved by @ahmedqgqgq #java

#include<iostream>
#include<fstream>
using namespace std;
int main()
{
	ofstream outfile("grades.txt", ios::out);
	if (!outfile)
	{
		cerr << "error:output file cannot be opened\n";
		exit(1);
	}
	char id[9], name[16];
	int grade;
	cout << "\t:";
	int n = 1;
	while (cin>>id>>name>>grade)
	{
		outfile << name << " " << id << " " << grade << endl;
		cout << "\t" << ++n << ":";
	}
	outfile.close();

}
content_copyCOPY