solution of question 2
[SET – 1]

C++ program, which initializes a string variable and outputs the string to the disk file

 

#include<fstream.h>

int main()
{
	ofstream fout;
	fout.open("out.txt");
	char str[300]="Time is a great teacher but unfortunately it kills
	 all its pupils. Berlioz";
	fout<<str;
	fout.close();
	return 0;
}