No products in the cart.

Write a program in c++ to …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Write a program in c++ to create a file and display its contents
  • 1 answers

Savio Devasia 5 years, 9 months ago

#include<fstream.h> #include<conio.h> #include<process.h> void main() { clrscr(); int x,y,z; ofstream Ofile("Savio.txt",ios::out); if(! Ofile) { cout<<"File not exsist "; exit(1); } else { cout<<"Enter the numbers "; cin>>x>>y>>x; Ofile<<x<<" "<<y<<" "<<z; Ofile.close(); } ifstream Ifile("Savio.txt",ios::in); if(! Ifile) { cout<<"File not exsist "; exit(1); } else { cout<<"Numbers are "; Ifile>>x>>y>>z; cout<<x<<" "<<y<<" "<<z; Ifile.close(); } getch(); }
http://mycbseguide.com/examin8/

Related Questions

What are called tokens
  • 2 answers
What is mean by buffering in file handling?
  • 1 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App