Answer to Question #180723 in C++ for Swara

Question #180723

Write a C++ program to create a new file named “college.txt” to store list of colleges under Punjab university. Read names of 3 colleges (consider input given below) from console and store it in “college.txt”. Further copy contents of “college.txt” in another file “university.txt”. Now open the “university.txt” file and display the following (underlined) characters on console using file manipulation functions.

Input:

Lovely Professional University

Thapar Institute of Engineering and Technology

Dr B R Ambedkar National Institute of Technology


1
Expert's answer
2021-04-13T00:19:13-0400
#include <iostream>
#include <fstream>
using namespace std;


int main () {
  ofstream myfile;
  myfile.open ("college.txt");
  myfile << "Now learnt C++; Java is my next target.\n";
  myfile.close();
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS