Uploaded by sadman jabir

cse 110 offline 2 set B (1)

advertisement
CSE 110
Computer Programming Sessional
Offline2
Set B (Subsection:A2, B2, C2)
Instructions:
(1) * Please DO NOT COPY solutions from anywhere (your friends, seniors, internet etc.). Any
form of plagiarism (irrespective of source or destination), will result in getting -100% marks in the
online/offline.
(2) Deadline: Announce on moodle
(3) Submit one file and rename it according to your roll number. If your roll number is 2206XXX
then submit 2206XXX.c / 2206XXX.cpp file.
(4) You will get 30 points for this assignment. A viva will also be conducted. If the teacher finds
that you don't know how to implement it, you'll get a score of 0.
Create Your Own Array Operation Toolkit
Welcome to the Array Operation Toolkit! In this assignment, you will
create a menu-driven C program for character array manipulation using
functions and arrays. You are required to implement various functions
to perform operations on character arrays and provide a user-friendly
menu.
Functions to Implement:
1. input_array:
- Parameters:
- Takes user input to initialize a character array.
- Returns:
- Initialized character array.
2. print_array:
- Parameters:
- Character array to print.
- Returns:
- None.
3. concatenate:
- Parameters:
- Two character arrays to concatenate.
- Returns:
- Resultant concatenated character array.
4. reverse:
- Parameters:
- Character array to reverse.
- Returns:
- Resultant reversed character array.
5. count_vowels:
- Parameters:
- Character array to count vowels.
- Returns:
- Number of vowels in the character array.
6. replace_character:
- Parameters:
- Character array, target character to replace,
replacement character.
- Returns:
- Resultant character array after replacement.
7. Upper_case:
- Parameters:
- Character array to convert to uppercase.
- Returns:
- Character array with all characters in uppercase.
8. Frequency_char:
- Parameters:
- Character array, target character to find frequency.
- Returns:
- Frequency of the specified character in the character
array.
9. Intersection:
- Parameters:
- Two character arrays to find the intersection.
- Returns:
- Character array representing the intersection.
10. Lexicographical_ordering:
- Parameters:
- Four character arrays to print in lexicographical order.
- Returns:
- None (prints the arrays).
11. Transpose_matrix:
- Parameters:
- Matrix to transpose.
- Returns:
- Transposed matrix.
12. Determinant_matrix:
- Parameters:
- Matrix to find determinant.
- Returns:
- Determinant of the matrix.
13. Power_matrix:
- Parameters:
- Matrix, exponent. ( exponent is less then 4)
- Returns:
- Resultant matrix raised to the given exponent.
Menu:
1) Input
2) concatenate
3) reverse
4) count_vowels
5) Print array elements
6) replace_char
7) Upper_case
8) frequency_count
9) Intersection
10)
Matrix Operation
11)Exit
How Your Program Works:
1. Start the program and specify the number of elements for
an array.
2. Select option 1 to input each element using the Input_array
function.
3. After inputting all elements, select a menu option to
perform the corresponding task.
4. Continue selecting menus for further operations.
5. When you select 10 as menu it will take you another
sub-menu have following option:
i.
Matrix Input
ii.
Determinant_matrix
iii.
Transpose_matrix
iv.
Power_matrix
v.
Back to main
6. In the Matrix operation sub-menu for each task try to show
each operation by calling the corresponding function from
the main module. Before invoke the function you can take
necessary parameters as input from the console and then
pass them.
7. You can take array size as argument wherever you needed
Grading Rubric for Array Operation Toolkit Program:Total 30 points
Function Implementations: 23 points
Function Name
Implementation Point
Input_array
0.5
Print_array
0.5
concatenate
2
reverse
2
count_vowels
2
replace_character
1
Upper_case
1
Frequency_char
1
Intersection
2
Lexicographical ordering
3
Transpose_Matrix
2
Determinant_Matrix
2
Power_Matrix
4
Menu-Driven Execution:
operations 7 points
Successful
execution
of
menu-driven
Additional Notes:
● The maximum array size can be set to 1000 for simplicity.
● Implement error handling for scenarios like exceeding the
maximum array size.
● Test your program with various arrays to ensure
correctness.
Download