Page 201 - C++
P. 201
each node has the following structure :
struct node
{ char name[20]
int marks; node *link;
};
class queue
{ node *front,*rear;
public:
queue() {front=rear=NULL; }
void delque();
};
f Define the function PUSH( ) to perform the push operation into a static STACK of the 2
following structure
struct TICKET
{ int Ticketno;
char PName[20];
};
4 a. Consider a stream F, which connects to file “EMP.DAT” containing objects of class Emp. 1
i) Write statement to position the file pointer 10 bytes before the end of the file
ii) Write statement to return the number of bytes from the beginning of the file to the
current position of the file pointer.
b. Write a function int COUNT_A( ) that counts and returns words starting with A in text 2
file “ABC.txt”.
For Example:
If the text file contains: An aeroplane is flying above the tower of the aerodrome.
Value returned will be : 4
c. Given a binary file ‘‘SPORTS.DAT’’ containing records of the following class : 3
class Player
{ char PNO[10]; //player number
char Name[20]; //Name of player
int score; //score of the player
public:
void EnterData(); // to input data
void DisplayData() // to display data
int Ret_score() {return score;}
};
Write a function in C++ that would read contents of the file ‘‘SPORTS.DAT’’ and display
the details of those players with score above 500 and also count and display the number
of players with score less than 100.
5 a. Differentiate between DDL and DML commands. 2
b. Consider the following tables and write queries for (i) to (v) and output for (vi) & (vii) 6
Table: CUSTOMER
Page 4 of 6