Replace Elements with Zeros
Given a MXN matrix, write a program to replace all elements that do not belong to principal-diagonal & anti-diagonal with Zeros. Principal-diagonal elements are the set of elements of a matrix that lie on the line joining the top left corner to the bottom right corner. Anti-diagonal elements are the set of elements of a matrix that lie on the line joining the bottom left corner to the top right corner.
Input
The first line of input will contain two space separated integers, denoting MxN matrix. The next M lines will contain N space-separated integers.
Output
The output should be MXN matrix by replacing elements that do not belong to principal-diagonal and anti-diagonal with Zeros. Print each row as a space separated integers in a single line.
Given a sentence, write a program to mix the words based on their index locations. The first word in the output should contain the first letter of each word in the given sentence and the second word should contain the second letter of each word in the given sentence and so on.
Note: The nth word in the output should contain th letter of each word in the given sentence. The letters of the output word should be in same order as the words in the given sentence. If a word in the given sentence doesn't have n-letters, you can skip it while considering the letters of the n-th word.
Input
The input will be a single line containing a string.
The output should be a single line containing the words by mixing based on their index locations.
K Sum Unique Combinations
Given a list of integers, write a program to print the count of all possible unique combinations of numbers whose sum is equal to K.
Input
The first line of input will contain space-separated integers. The second line of input will contain an integer, denoting K.
Output
The output should be containing the count of all unique combinations of numbers whose sum is equal to K.
Use the concept of aggregation/composition to write a C++ program which will ask the user
to enter the center points and radii for two circles. Then find the perimeters of both the circles
and decide whether the circles will intersect or not.
Use the concepts of inheritance and abstract base class to compute the fencing cost for a
triangular, circular and rectangular region. The fencing cost for 1m is 200/-.
Online Cake Ordering System: 1) Add a new order 2) Retrieve an order 3) Deliver an order 4) Print summary report 5) Exit system
+ a new order
Retrieve order
retrieve&remove the order (with nearest delivery data&time) from the binary heap data structure & update the status as “in progress” &move the order into queue data structure.
Deliver order
The user will retrieve a work in progress order from queue based on first in first out (FIFO) concept and move the order to a stack. Status of order will be updated as “delivered”.
View summary report
No built-in classes of data structure (heap, queue and stack) are allowed.
the program should generate two random numbers between 1 and 20 and display the first number. It should then ask the user to enter either H or L for Higher or Lower. The user wins if they entered H and the second number was higher than the first or when they entered L and the second number was lower.
Write a program to calculate the probability of getting two six out of 1 thousand times on rolling two dice.
**The teacher gave us a hint by giving a part of the code**
#include <iostream>
#include "time.h"
using namespace std;
int main()
{
srand (time(NULL)); // to introduce different random numbers each run
// Complete
}
The following table shows the latest fees Al Ummah Islamic School.
First Child = RM 500
Second Child Onwards RM 450
a) Function calcFees () will receive the number of children and will calculate and return the fee.
b) Function calcDisc () will receive the fee and return the totalFee. If the users want to pay yearly, they will get a 10 % discount.
c) Function main () will prompt the users to input the number of children they wish to enroll in the school and whether the user want to pay yearly. Then, it will call function calcFees () and calcDisc(). The program will then display the following receipt.
******* AL UMMAH ISLAMIC SCHOOL ****************
NUMBER OF CHILDREN : 3 TOTAL
MONTHLY FEE : RM 1400
TOTAL YEARLY FEE : RM 16800
TOTAL YEARLY FEE (DISCOUNT) : RM 15120
THANK YOU FOR BEING PART OF AL UMMAH ISLAMIC SCHOOL!
access and prevent employees from accessing the hard drive and printer. The following day, you receive 50 emails from users complaining of broken computers since none of them can print from their computer any longer. You know this is by design but understand many users may have concerns with this new process. How do you handle these issues and hep users understand security concerns, process changes, and making the change process easier?