Multiply Two Matrices Using Multi-Dimensional Arrays in C++

Samual Sam
Updated on 24-Jun-2020 08:02:07

5K+ Views

A matrix is a rectangular array of numbers that is arranged in the form of rows and columns.An example of a matrix is as follows.A 3*3 matrix has 3 rows and 3 columns as shown below −8 6 3 7 1 9 5 1 9A program that multiplies two matrices using multidimensional arrays is as follows.Example Live Demo#include using namespace std; int main() {    int product[10][10], r1=2, c1=3, r2=3, c2=3, i, j, k;    int a[2][3] = { {2, 4, 1} , {2, 3, 9} };    int b[3][3] = { {1, 2, 3} , {3, 6, 1} , {2, 9, 7} };    if (c1 != r2) {       cout

Flip an Image on Mouse Over with CSS

Jennifer Nicholas
Updated on 24-Jun-2020 08:01:49

423 Views

Use the transform CSS property to flip an image. You can try to run the following code to flip an image on mouseover:ExampleLive Demo                    .myimg:hover {             transform: scaleX(-1);          }                     Heading One       Let's flip the image on mouse over:          

Subtract Complex Number Using Operator Overloading in C++

Samual Sam
Updated on 24-Jun-2020 07:59:53

3K+ Views

Operator overloading can be done with most of the built-in operators in C++. The overloaded operators are functions with the keyword operator followed by the operator symbol that is defined. The overloaded operators have a return type and a parameter list like any function.A program that subtracts complex numbers using operator overloading is as follows −Example Live Demo#include using namespace std; class ComplexNum {    private:    int real, imag;    public:    ComplexNum(int r = 0, int i =0) {       real = r;       imag = i;    }    ComplexNum operator - (ComplexNum const ... Read More

Find ASCII Value of a Character in C++

karthikeya Boyini
Updated on 24-Jun-2020 07:58:54

10K+ Views

There are 128 characters in the ASCII (American Standard Code for Information Interchange) table with values ranging from 0 to 127.Some of the ASCII values of different characters are as follows −CharacterASCII ValueA65a97Z90z122$36&38?63A program that finds the ASCII value of a character is given as follows −Example Live Demo#include using namespace std; void printASCII(char c) {    int i = c;    cout

C++ Program to Multiply Two Numbers

Samual Sam
Updated on 24-Jun-2020 07:58:02

3K+ Views

Multiplication of two numbers a and b yields their product. Value of a is added as many times as the value of b to get the product of a and b.For example.5 * 4 = 20 7 * 8 = 56 9 * 9 = 81Program to Multiply two Numbers using * OperatorA program to multiply two numbers using the * operator is given as follows −Example Live Demo#include using namespace std; int main() {    int a = 6, b = 8;    cout

Check Whether a Number is Palindrome in C++

karthikeya Boyini
Updated on 24-Jun-2020 07:57:21

3K+ Views

A palindrome number remains the same if its digits are reversed i.e its value does not change. A palindrome number can also be called symmetric. For example: The numbers 12321, 1551, 11 etc are palindromes as they do not change even if their digits are reversed.A program that checks if a number is palindrome or not is as follows.Example Live Demo#include using namespace std; void palindrome(int num) {    int rev=0,val;    val = num;    while(num > 0) {       rev = rev * 10 + num % 10;       num = num / 10;    }    if(val==rev)    cout

Create Command Menu Item from Popup Menu in HTML5

Ankith Reddy
Updated on 24-Jun-2020 07:54:05

300 Views

Use the tag to create a command/ menu item that the user can invoke from a popup menu in HTML5. The HTML tag is used for defining a menu item for a menu.The following are the attributes of the tag −AttributeValueDescription  checked  checked defines that a menuitem should be   checked default  default a menuitem is marked as a default   command disabled  disabled disables a menuitem and cannot be clicked icon  url defines an icon for a menuitem label  text defines a name for a menuitem which is displayed to the user radiogroup  groupname defines a group of commands out of which only one can be selectedtype ... Read More

Find All Roots of a Quadratic Equation in C++

karthikeya Boyini
Updated on 24-Jun-2020 07:47:19

9K+ Views

A quadratic equation is in the form ax2 + bx + c. The roots of the quadratic equation are given by the following formula −There are three cases −b2 < 4*a*c - The roots are not real i.e. they are complexb2 = 4*a*c - The roots are real and both roots are the same.b2 > 4*a*c - The roots are real and both roots are differentThe program to find the roots of a quadratic equation is given as follows.Example#include #include using namespace std; int main() {    int a = 1, b = 2, c = 1;    float discriminant, ... Read More

Include Direction of Text Display in HTML

Rishi Rathor
Updated on 24-Jun-2020 07:36:47

212 Views

Use the dir attribute in HTML, to add the direction of the text.ExampleYou can try to run the following code to include the direction of text display in HTML −           This is demo text from left-to-right.       This is demo text from right-to-left.    

Define Number of Columns in CSS Grid Layout

Rishi Rathor
Updated on 24-Jun-2020 07:34:15

1K+ Views

Use the grid-template-columns property to define the number of columns in CSS Grid Layout.You can try to run the following code to set a number of columns. Here, 3 column grid is set:ExampleLive Demo                    .container {             display: grid;             background-color: yellow;             grid-template-columns: auto auto auto;             padding: 20px;             grid-gap: 20px;          }          .container > div {             background-color: blue;             border: 2px solid gray;             padding: 35px;             font-size: 30px;             text-align: center;          }                     Game Board                1          2          3          4          5          6          

Advertisements