Professional Documents
Culture Documents
CP Lab Manual
CP Lab Manual
Computer Programming
Write a program that inputs a floating point number, an operator and another
floating point number. It displays the result by performing the operation on the
6 given number. If the operator is division, it should check to make sure the divisor is
not equal to zero. If the operator is not a +,-,*, or / then the program should print an
error.
Write a program that converts ASCII number to character and vice versa. The
program should display the following menu:
7
a. Convert ASCII value to character
b. Covert character to ASCII value
Lab#8 2D Arrays
Sr# Programs
Write a program that initialize a two dimensional array of 2 rows and 3 columns
1
and then displays its values.
Write a program that initialize a two dimensional array of 2 rows and 4 columns
2
and then displays minimum and maximum numbers in the array.
Write a program to add two matrices. Input order of matrix (i.e rows and columns).
The matrices must be of same size to be added. Get the input for each element of
3
the first matrix and then second matrix. Add the two matrices and store the values
in third matrix. Then display all matrices.
Write a program that inputs the number of rows and columns from user. It then
inputs the elements to store in the matrix. The program calculates the sum of each
4
row and each column and displays on the screen. I it is a square matrix, it also
calculates the sum of diagonal elements and displays it on screen.
Write a program that inputs integer values in a 4x4 matrix and displays sum of
5
diagonal elements of the matrix.
Write user defined functions for square matrix to calculate
6 1. Left diagonal sum
2. Right diagonal sum
Write a user-defined function in C++ to display the multiplication of row
7
element of two-dimensional array A[4][6] containing integer.
8 Write a program to multiply array A and B of order NxL and LxM
Write a user defined function named Upper-half() which takes a two
dimensional array A, with size N rows and N columns as argument and
prints the upper half of the array.
e.g.,
23150 23150
9
71531 1531
2 5 7 8 1 Output will be: 178
01501 01
34915 5
Write a program which inputs a 2D array of size M x N and display original matrix
10
and its transpose.