Rotate Matrix Rings
Given matrix of order M*N and a value K, write a program to rotate each ring of the matrix clockwise by K elements. If in any ring has less than or equal to K elements, then don’t rotate that ring.Input
first line of input will be two space-separated integers, denoting the M and N.
next M lines will contain N space-separated integers.
next line will contain an integer, denoting K.Output
output should be M*N matrix by rotating the matrix by K element.Explanation
if the given M and N are 4 and 4 respectively. If the matrix elements
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
If the given K is 3. Rotate each ring of the matrix by 3 elements.
In the above matrix, the elements (1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5) is a ring, similarly, the elements (6, 7, 11, 10) will make a ring.
Therefore, by rotating each ring in clockwise direction by 3 elements will give (13, 9, 5, 1, 2, 3, 4, 8, 12, 16, 15, 14) and (10, 6, 7, 11). So the output should be
13 9 5 1
14 7 11 2
15 6 10 3
16 12 8 4
Develop a C++ program to use skipws flags which skips white space on input of three words.
Develop a C++ programs on BANKING SYSTEM have Customer class with name, address and phoneno. Create derived class account class with data members like account number, name, deposit, withdraw amount and type of account. A customer can deposit and withdraw amount in his account. Develop a C++ program to display the details of a customer and the remaining balance amount. [Note: Use virtual function]
Write a C++ program to implement time class that has separate data members for hours, minutes and seconds. Overload + Operator to add two times (object) and -- operator to decrement the time by one second.
Write a program to negate the value of the object which has matrix of elements using unary minus operator overloading.
Design the class Vowel to find the number of vowels present in the given string. Define the constructor member function to assign the values and destructor member function to destroy the data objects.
Create a class Armstrong and include startnumber and endnumber as data member and aslo include member function findArmstrongNumbers() to find all the Armstrong numbers between startnumber and endnumber. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number.
Define a class Book with the following specifications:
Private members of the class BOOK are
BOOK NO integer type BOOKTITLE 20 characters PRICE float (price per copy) TOTAL_COST() A function to calculate the total cost for N number of copies where N is passed to the function as argument.
Public members of the class BOOK are
INPUT() function to read BOOK_NO, BOOKTITLE and PRICE. PURCHASE() function to ask the user to input the number of copies to be purchased. It invokes TOTAL_COST() and prints the total cost to be paid by the user.
The kids Ram and Anandh are using magic numbers. For example, Ram magic number is 4 and Anandh magic number is 6. The kids exchange their magic number and display the Ram magic number is 6 and Anandh magic number is 4. Implement the above logic using function. [Note: Use call by address]
Create a class movie for ticket booking with data members theatrename, date, moviename, screenno, amount, no_of_tickets and total_amount and include functions reservation() , bookiing_details().
Create dynamic object and display ticket booking details.