Level up your skills by byte size resources
Path intended to achieve your particular goal.
Find dozens of free cheatsheets for quick reference.
Find the Archive of our bootcamps and quick tutorial videos.
Indepth Information about a certain topics.
Create a file to store the data of a student in a file and close the file. Make use of structures and store this data in a file names new_filewrite.
Solution:
#include using namespace std; struct student{ char name[20]; char course[20]; int rollNo; }; main() { student a; cout<<"enter the name:"; cin>>a.name; cout<<"/nEnter course:"; cin>>a.course; cout<<"/nenter rollno:"; cin>>a.rollNo; fstream newFile; newFile.open("new_filewrite.txt",ios::out); if(!newFile) { cout<<"File creation failed"; } else { cout<<"New file created"; newFile<<"NAME:"<
Output: New file created