assignment 6 7
TRANSCRIPT
-
8/6/2019 Assignment 6 7
1/2
NCE@Computer Programming I
Prepared by Om Prakash Mahato 1
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 shouldbe displayed in the calling function.
4. Write a Program to make the students names of n numbers in alphabetic order using concept ofpointer.
5. Write a Program to make any array in ascending or descending order using concept of dynamic memoryallocation. 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 arepositive, 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 afunction where even numbers are filtered into another array and display the array containing even
numbers in the main function.
-
8/6/2019 Assignment 6 7
2/2
NCE@Computer Programming I
Prepared by Om Prakash Mahato 2
Laboratory Session#7: Structure
1. Create a Structure named STUDENT that has name, roll, marks and remarks as members. Assumeappropriate 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 asa 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 completeprogram using structure to read and display the data entered by user having calculation ofpercentage with proper grade of each student in good format.
3. Write a two structures CAR and VEHICLE, one within another. Make company name, date ofsupply 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 shouldcontain 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 programthat 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.