Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Write a program using user defined function Swap() which receives two
3 integers as parameters and swaps the values.(Demonstrating call by
reference
Write the function WriteStory() that will take a story from keyboard and
write to the file “STORY.TXT”. Write another function CopyStory() to
13 copy only those words that are not starting with uppercase and vowels
from “STORY.TXT” and write to another text file “STORY1.TXT”. Call
the above two function in main() function.
Write a menu based program using array to arrange the numbers using
the following methods on the basis of user’s choice.
1. Ascending Order Using Selection Sort
15
2. Descending Order using Bubble Sort
3. Ascending Order Using Insertion sort
4. Exit
Write a menu based program using Linked Implementation to do Stack
operations with the following options on the basis of user’s choice.
1. Push an Element
2. Pop an Element
3. Print Stack
4. Exit
struct Node
16 { int X, Y; Node *Link; };
class STACK
{ Node * Top;
public:
STACK( ) { TOP=NULL;}
void PUSH( ); void Pop( ); ~STACK( );
};
Write a menu based program using array to do Stack operations with the
following options on the basis of user’s choice.
1. Push an Element
2. Pop an Element
3. Print Stack
4. Exit.
class stack
17 { int data[10];
int top;
public:
Stack( ) { top=-1;}
void push ( ); // to push an element into the stack
void pop ( ) ; // to pop an element into the stack
void display( );// to display all the elements from the stack
};
Write a menu based program using array to do Queue operations with
the
following options on the basis of user’s choice.
1. Insert an Element
2. Delete an Element
3. Print Queue
18 4. Exit
class Q
{ int data[10];
int front, rear;
public:
Q ( ) { front=rear=-1;}
void Insert ( ); void Del ( ) ; void Display( );
Write a menu based program using Linked List to do Queue operations
with the following options on the basis of user’s choice.
1. Insert an Element
2. Delete an Element
3. Print Queue
4. Exit
struct NODE
{ long TicketNo;
19 char PName[20]; // Passenger Name
NODE *NEXT;
}
class TrainQueue
{ NODE *rear, *front;
public:
TrainQueue( ) { rear = NULL, front = NULL ;}
void Q_Insert( ); void Q_Delete ( );
void Q_Display ( ); ~TrainQueue( );
};
Write a menu based program using array to do Circular Queue
operations with the following options on the basis of user’s choice.
1. Insert an Element
2. Delete an Element
3. Print Queue
20 4. Exit
class Q
{ int data[10]; int front, rear;
public:
Q ( ) { front=rear=-1;}
void Insert ( ); void Del ( ) ; void Display( );
};