Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
79 views

Program

The document describes programs involving pointers, structures, and file handling in C. It includes tasks such as using pointers to perform arithmetic operations on numbers, exchange variable values, calculate circle properties, and search arrays. It also involves creating structures for customers, employees, cricketers, and students, and using them to sort, search, and print records. Finally, it covers file operations like copying, merging, encrypting/decrypting using offset and substitution ciphers.

Uploaded by

madhu naik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Program

The document describes programs involving pointers, structures, and file handling in C. It includes tasks such as using pointers to perform arithmetic operations on numbers, exchange variable values, calculate circle properties, and search arrays. It also involves creating structures for customers, employees, cricketers, and students, and using them to sort, search, and print records. Finally, it covers file operations like copying, merging, encrypting/decrypting using offset and substitution ciphers.

Uploaded by

madhu naik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Program on pointer, structure and file handling

1. Write a C program to perform addition and subtraction of two numbers using pointer.

2. write a C program to perform multiplication and division of two numbers using pointer.

3. Write a C program to exchange the values of two variables Using pointer.

4. Write a C program using pointer to calculate the area and perimeter of a circle.

5. Write a C program using pointer to enter an array and find the smallest number, largest number,
and display its position ad also compute its average, standard deviation and variance from the given
array .

6. Write a C program using pointer to enter a character through the keyboard and then determine
whether it is a vowel or not.

7. Write a C program using pointer to enter an array through the keyboard and search an element
in the given array using binary search algorithm.

8. Write a C program to sort an array in increasing order and also decreasing order using pointer.

9. Write a C program that compares two given dates. To store date use structure say date that
contains three members namely: date, month and year. If the dates are equal, then display message
as "Equal" otherwise "Unequal".

10. Create a structure to specify data of customers in a bank. The data to be stored is: Account
number, Name, Balance in account. Assume maximum of 200 customers in the bank.
a. Write a C function to print the Account number and name of each customer with
balance below Rs. 100.
b. If a customer requests for withdrawal or deposit, it is given in the form:
Acct. no, amount, code (1 for deposit, 0 for withdrawal)
Write a program to give a message, “The balance is insufficient for the specified
withdrawal”.
11. Create a structure called employee that holds information about employee like employee code,
name, and date of joining. Write a C program to create an array of the structure and enter some data
into it. Then ask the user to enter current date. Display the names of those employees whose tenure
is 3 or more than 3 years, according to the given current date.

12. A record contains name of cricketers, their age, and number of test matches he has played and
the average runs that he has scored in each test match. Create an array of structure to hold records
of 20 such cricketers and then write a C program to read these records and arrange them in
ascending order of their average runs.
13. Write a program to delete all vowels from a sentence using pointer. Assume that the sentence is
not more than 80 characters long.

14. Write a program to count the number of occurrences of any two vowels in succession in a line
of text using pointer. For example, in the sentence “Pleases read this application and give me
gratuity” such occurrences are ea, ea, ui.

15. Write a program to encode the following string such that it gets converted into an
unrecognizable form using pointer. Also write a decode function to get back the original
string."Man's reach must always exceed his grasp.... or what is the heaven for?"

16. Create a structure to specify data on students given below:

Roll number, Name, Department, Course, Year of joining .Assume that there are not more than 450
students in the collage.

(a) Write a function to print names of all students who joined in a particular year.

(b) Write a function to print the data of a student whose roll number is given.

17. Create a structure to specify data of customers in a bank. The data to be stored is:

Account number, Name, Balance in account. Assume maximum of 200 customers in the bank.

(a) Write a function to print the Account number and name of each customer with balance below
Rs. 100.

(b) If a customer request for withdrawal or deposit, it is given in the form:

Acct. no, amount, code (1 for deposit, 0 for withdrawal) Write a program to give a message, “The
balance is insufficient for the specified withdrawal”.

18. An automobile company has serial number for engine parts starting from AA0 to FF9. The other
characteristics of parts to be specified in a structure are: Year of manufacture, material and quantity
manufactured.

(a) Specify a structure to store information corresponding to a part.

(b) Write a program to retrieve information on parts with serial numbers between BB1 and CC6.

19. A record contains name of cricketer, his age, number of test matches that he has played and the
average runs that he has scored in each test match. Create an array of structure to hold records of
20 such cricketer and then write a program to read these records and arrange them in ascending
order by average runs. Use the qusort( ) standard library function.

20. Write a menu driven program that depicts the working of a library. The menu options should
be:

1. Add book information


2. Display book information

3. List all books of given author

4. List the title of specified book

5. List the count of books in the library

6. List the books in the order of accession number

7. Exit

Create a structure called library to hold accession number, title of the book, author name, price of
the book, and flag indicating whether book is issued or not.

21. Write a program to create a text file.

22. Suppose a file contains student’s records with each record containing name and age of a
student. Write a program to read these records and display them.

23. Write a program to copy one file to another. While doing so replace all lowercase characters to
their equivalent uppercase characters.

24. Write a program that merges lines alternately from two files and writes the results to new file. If
one file has less number of lines than the other, the remaining lines from the larger file should be
simply copied into the target file.

Write a program to encrypt/decrypt a file using:

25. An offset cipher: In an offset cipher each character from the source file is offset with a fixed
value and then written to the target file. For example, if character read from the source file is ‘A’,
then convert this into a new character by offsetting ‘A’ by a fixed value, say 128, and then writing
the new character to the target file.

26. A substitution cipher: In this each character read from the source file is substituted by a
corresponding predetermined character and this character is written to the target file.For example,
if character ‘A’ is read from the source file, and if we have decided that every ‘A’ is to be substituted
by ‘!’, then a ‘!’ would be written to the target file in place of every ‘A’ Similarly, every ‘B’ would be
substituted by ‘5’ and so on.

You might also like