Sunteți pe pagina 1din 2

NCE@Computer Programming I

Laboratory Session#6: Pointer 1. Write a program to find largest number using pointer and Function concept. 2. Write a Program to find the average of an integer array using pointer and Function concept. 3. Write a function that takes a string as an input and counts the number of vowels, consonants, numeric characters and other characters. The calling function should read the string and pass it to the function. After the function call, the count of vowels, consonants, numeric characters and other characters should be displayed in the calling function. 4. Write a Program to make the students names of n numbers in alphabetic order using concept of pointer. 5. Write a Program to make any array in ascending or descending order using concept of dynamic memory allocation. User Function for main objective of a program. (Hint use library functions malloc() or calloc() and free() in the header file alloc.h)

ASSIGNMENT#6 1. WAP to find the sum of two integer numbers using pointer and function. 2. WAP to insert an element into the array in the position specified by the user using pointer. 3. WAP that prompts the user of two strings, assemble them into a single string and then print the string in reversed using two different functions and pointer. 4. Write a complete program that adds the corresponding elements of two matrices if the elements are positive, otherwise multiply corresponding elements using the concept of passing to the function and pointer. 5. WAP to sort the string in alphabetical order using concept of pointer. 6. WAP to find a determinant of any matrix using concept of pointer and Function. 7. Write a program to print the largest integer value in the array. Make the use of concept of dynamic memory allocation of initialization the array. 8. Write a program that reads positive integer numbers into an array dynamically and pass them to a function where even numbers are filtered into another array and display the array containing even numbers in the main function.

Prepared by Om Prakash Mahato

NCE@Computer Programming I

Laboratory Session#7: Structure


1. Create a Structure named STUDENT that has name, roll, marks and remarks as members. Assume appropriate type and size of members. Write complete program using the structure to read and display the data entered by the user. 2. Create a structure name MARKS that has subject and mark as its members. Include this structure as a member for the structure created in Program 1 and read data for 8 students. The modified structure must have provision to store marks of five subjects for each student. Write a complete program for that. [Hint: Create MARKS structure before STUDENT structure and make one member of an five elements of type MARKS]. 3. Modify program 1 such that it uses pointer to structure instead of structure itself. 4. Write a program using structure and passing the structure to the function that returns the result after converting the date (in format YY/MM/DD) in B.S. to A.D. 5. Write a program to compute any two instant hop distances in a format (feet: inches) using structure . Build functions to add and subtract given hop distances and display the results in main function. Use concept of pointer and structure. ASSIGNMENT#7 1. Create a structure CUSTOMER that has customer code, name, address, units as members. Assume appropriate type and size of members. Write a complete program using the structure to read and display the data entered by the user with calculation of total charge to be paid by customer in good format. 2. Create a structure STUDENT that name, roll, marks of 7 subjects of a student. Write a complete program using structure to read and display the data entered by user having calculation of percentage with proper grade of each student in good format. 3. Write a two structures CAR and VEHICLE, one within another. Make company name, date of supply and lot_no as members of VEHICLE and model_no, prince as member of CAR. Read and display the corresponding data using concept of function and structure. 4. Write a program to manipulate two complex number using structures. The structure should contain real and imaginary part as its members. Write separate functions to add, subtract, multiply and divide complex numbers. 5. Create a structure TIME containing hour, minute and seconds as its members. Write a program that uses this structure to input start time and stop time in main(). Pass structures to a function by reference that calculates the sum and difference of start and stop time. Display sum and difference from main(). 6. Create an array of structure named EMPLOYEE of size n dynamically. Structure has name, age, address, salary and phone numbers as its members. The array of structure is passed to a function which sorts the array in ascending order on the basis of salary and displays the sorted array from main(). 7. Create a structure to specify the data on students given below: Name, Roll No, Department, Year of joining. Assume that there are not more than 50 students in the college. A) Write a function to print the 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 pressed by user.
Prepared by Om Prakash Mahato 2

S-ar putea să vă placă și