0% found this document useful (0 votes)
121 views2 pages

Class XIIFile Handling Assignment

The document provides 10 file handling problems involving C++ programs: 1. Change all occurrences of A to 2 in a file 2. Convert letters sequentially in a file 3. Count occurrences of a character in a file 4. Count a word in a text file 5. Delete words starting with vowels from a file 6. Menu driven program to read/write binary employee data file 7. Copy records with given area code from one binary file to another 8. Modify records in a binary file based on a condition and write to file 9. Copy records with a given game name to a new binary file 10. Display records from a binary file with percentage above a value

Uploaded by

Kartik Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views2 pages

Class XIIFile Handling Assignment

The document provides 10 file handling problems involving C++ programs: 1. Change all occurrences of A to 2 in a file 2. Convert letters sequentially in a file 3. Count occurrences of a character in a file 4. Count a word in a text file 5. Delete words starting with vowels from a file 6. Menu driven program to read/write binary employee data file 7. Copy records with given area code from one binary file to another 8. Modify records in a binary file based on a condition and write to file 9. Copy records with a given game name to a new binary file 10. Display records from a binary file with percentage above a value

Uploaded by

Kartik Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Class XIIFile Handling Assignment 1.

Write a program to accept the file name from the user and change all the occurrences of A with a 2.Write a program to accept the file name from the user and convert A to B, B to C and so on and Zto A 3.Write a program to accept the file name from the user and find a character in the file tell how manytimes it occurs in the file .4.Write a function in C++ to print the count of the word is as an independent word in a text fileDIALOGUE.TXT.For example,if the content of the file DIALOGUE.TXT isThis is his book. Is this book good ?Then the output of the program should be 2. 5.Write a program to delete all the words starting with a vowel from file abc.txt. 6 . C o n s i d e r a c l a s s Class EMPLOYEE{int ENC;char ENAME[0];PUBLIC:Void GETIT(){ cin>> ENO;gets(ENAME);}Void SHOWIT() { cout>> ENO<<ENAME;<<endl; }};Write a menu driven program to read and write in the binary data file emp.dat 7. Given a binary file PHONE.DAT, containing records of the followingstructure typeclass phonlist{ char Name[20] ;char Address[30] ;char AreaCode[5] ;char PhoneNo[15] ; public ;void Register( ) ;void Show( ) ;int CheckCode(char AC[ ]){ return strcmp(AreaCode, AC) ;}} ;Write a function TRANSFER( ) in C++, that would copy all those records which are having AreaCodeas .DEL. from PHONE.DAT to PHONBACK.DAT.8. Observe the program segment given below carefully, and answer the question that follows :class PracFile{ int Pracno ;char PracName[20]int TimeTaken ;int Marks ; public :

void EnterPrac( ) ;//Function to enter PracFile detailsvoid ShowPrac( ) ://Function to display PracFile detailsint RTime( ) //function to return Time Taken{return TimeTaken;}void Assignmarks(int M) //Function to assign Marks{ Marks = M ;}} ;void AllocateMarks( ){ fstream File ;File.open (.MARKS.DAT., ios :: binary l ios :: in l ios :: out ) ;PracFile P ;int Record = 0 ;while (File.read ( (char*) &P, sizeof (P) ) ){ if (P.RTime( ) > 50)P.Assignmarks(0)ElseP.Assignmarks(10) Record++ ;}File . close( ) ;}If the function AllocateMarks( ) is supposed to Allocate Marks for the records in the fileMARKS.DAT based on their value of the member TimeTaken. Write C++ statements for the statement1 and statement2 , where, statement1 is required to position the file write pointer to anappropriate place in the file and statement2 is to perform the write operation with the modifiedrecord.9. Given a binary file GAME.DAT, containing records of the following structure typestruct Game{ char GameName[20] ;char Participate[10][30] ;} ;Write a function in C++ that would read contents from the file GAME.DAT and creates a file namedBASKET.DAT copying only those records from GAME.DAT where the game name is Basket Ball.10. Given a binary file STUDENT.DAT, containing records of the following class Student typeclass Student{ char S_Admno[10] ; //Admission number of studentchar S_Name[30] ; //Name of studentint Percentage ; //Marks Percentage of student public :void EnterData( ){ gets(S_Admno) ; gets(S_Name) ; cin

>> Percentage ;}void DisplayData( ){ cout << setw(12) << S_Admno ;cout << setw(32) << S_Name ;cout << setw(3) << Percentage << endl ;} int ReturnPercentage( ) {return Percentage ;}} ;Write a function in C++, that would read contents of file STUDENT.DAT and display the details of those Students whose Percentage is above 75.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy