Вы находитесь на странице: 1из 5

1.

WAP that inputs a five-digit number, separate the number into its individual digit and print the digits in the following format. For ex: Input: 14568 Output 1 14 145 1456 14568 2. WAP to print whether a given character is an uppercase or a lowercase character or a digit or any other character. Use ASCII codes for it. The ASCII codes are given below: Characters ASCII range 09 AZ az other characters 48 57 65 90 97 122 0 255 excluding the above mentioned ranges

3. Write a C++ program to create an array of 100 numbers. Sort the numbers using bubble sort and Search for a number using binary search.

4. Write a function in C++ to search for an element in an array containing integer values using linear Search. If the search is successful function returns the position and minus one (-1) otherwise. 5. WAP in C++ to take a string as input, and replace a particular character with the character taken as input. Eg.: Enter the string: INFORMATION Enter the character to be replaced: I Enter the replacement character: $ Resultant string: $NFORMAT$ON 6. WAP to take a matrix as input and store its transpose into the other matrix. 7. WAP to take a matrix to store names of 10 students. Take a character as input and print the names of all students whose name starts with that character.

8. Write a function in C++ to sort an integer array of 10 elements using selection sort method. 9. Define a function Reversearray (int [], int) that would accept a one dimensional integer array NUMBERS and its size N. the function should rearrange the array in such a way that the values of alternate locations of the array are exchanged (Assume the size of the array to be even). Example: If the array contains 2 5 9 14 17 8 9 16 Then after rearrangement the array should contain 5 2 14 9 8 17 16 9 10. Write a user defined function named Upper_half()which takes a two dimensional array A, with size M rows and N columns as argument and print the upper half of the array. e.g: 2 7 If A is 2 0 3 3 1 5 1 1 5 0 1 1 1 5 The output will be 2 3 1 1 5 7 5 3 8 0 0 1 1 1 5

5 3 7 8 5 0

4 9 1

11. Write a function in C++ which accepts an integer array and its size arguments/parameters and assign the elements into a two dimensional array of integers in the following format: If the array is 1 2 3 4 5 6 The resultant 2 D array is given given below below 123456 123 123450 120 123400 100 123000 120000 100000 12. Write a function in C++ which accepts an integer array and its size as arguments and replaces elements having odd values with thrice its value and elements having even values with twice its value. Example: if any array of five elements initially contains the elements as 3,4,5,16,9 Then the function should rearrange the content of array as 9,8,15,32,27. if the array is 1 2 3 The resultant 2 D array is

13. Define a class SERIAL in c++ with the following specification:

Private members of class serial: Serialcode Title Duration Noofepisodes integer 20 characters float integer

Public member function of class serial: A constructor function to initialize Duration as 30 and Noofepisodes as 10. New_Serial()function to assign the values of Duration and Noofepisodes with the help of corresponding values passed as parameters to this function. Dispdata() function to display all the data members on the screen.

14. Write a program in c++ to create a library information system using class containing the following for all books in the library : Data member: a) b) c) d) e) f) Access number . Name of the author. Title of the book. Publishers name. Price of the book. Number of copies.

Member functions : a) b) To add any new book to the list of books in the library. To delete a book from the library.

c) To display names of the books authors name and the price of each books. 15. Assume that a text file named TEXT 1.TXT all ready contains some text written into it. Write a function named vowelwords(), that reads the file TEXT1.TXT and create a new file named TEXT2.TXT, which shall contain only those words from

the file TEXT1.TXT which dont start with an uppercase vowel (i.e, with A, E,I,O.U). FOR EXAMPLE if the file TEXT1.TXT contains Carry Umbrella and Overcote When it Rains Than the TEXT2.TXT shall contain Carry When it Rains

16. Write a function in C++ to count and display the number of lines starting with alphabet A present in a text fileLINES.TXT contains the following lines. A boy is playing there. There is a playground. An aeroplane is in the sky. Alphabets and numbers are allowed in the password. THE FUNCTION SHOULD DISPLAY THE OUTPUT AS 3

17. Given a binary file STUDENT.DAT containing records of the following class student type
class student { Char S_Admno[10];//Admission number of student Char S_Name[30]; public: void EnterData() { gets(S_Admno); gets(S_Name);cin>>percentage; } void display data() { cout<<setw(12)<<S_Admno; cout<<setw(32)<<S_Name; cout<<setw(3)>> percentage<endl; } //Name of student

int Return_per(){return percentage;} };

Write a function in C++ that would read contents of file STUDENT.DAT and display the details of those student whose percentage is above 75. 18. Declare a structure in C++telerec, containing name (20 characters) and telephone number. A binary data file TELE.DAT stores data of the type telerec. Write functions in C++ to do the following: a) To append records in the file. b) Error message: Record not found.

19. Write an interactive menu drive C++ program to implement queue using a linked list (insert, Delete and display) a node consists of character data value.

20. Write an interactive menu drive C++ program to implement queue using a linear array (add, Delete & display). Queue is used to store integer.

21. Write a function in C++ to perform push operation in a dynamically allocated stack containing admission numbers of student .Also declare the relevant class/structure and pointers.

22. Polynomial program

Вам также может понравиться