Search
 
SCRIPT & CODE EXAMPLE
 

CPP

identity

#include<iostream>
using namespace std;

int main()
{
	int i, j, rows, columns, flag = 1;
	
	cout << "
Please Enter Matrix rows and Columns to find Identity Matrix =  ";
	cin >> i >> j;
	
	int identMatrix[i][j];
	
	cout << "
Please Enter the Identity Matrix Items
";
	for(rows = 0; rows < i; rows++)	{
		for(columns = 0; columns < i; columns++) {
			cin >> identMatrix[rows][columns];
		}		
	}

 	for(rows = 0; rows < i; rows++)
  	{
   		for(columns = 0; columns < j; columns++)
    	{
    		if(identMatrix[rows][columns] != 1 && identMatrix[columns][rows] != 0)
    		{
    			flag = 0;
    			break;
			}
   	 	}
  	}
  	if(flag == 1)
  	{
  		cout << "
The Matrix that you entered is an Identity Matrix";
	}
	else
	{
		cout << "
The Matrix that you entered is Not an Identity Matrix";
	}  	

 	return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ to mips converter online 
Cpp :: c++ stack 
Cpp :: texorpdfstring math in title latex 
Cpp :: cpp module 42 
Cpp :: find min and max in array c++ 
Cpp :: convert c++ to mips 
Cpp :: c++ Testing implementation details for automated assessment of sorting algorithms 
Cpp :: c++ program for inflation rate of two numbers 
Cpp :: why wont a function stop C++ 
Cpp :: gcd multi num 
Cpp :: ordine crescente di numeri indefiniti in c++ 
Cpp :: c++ program that put a space in between characters 
Cpp :: c++ reverse bits 
Cpp :: Qt asynchronous HTTP request 
Cpp :: c++ map change order 
Cpp :: Difference Array | Range update query in O 
Cpp :: dfs in tree using adjacency list 
Cpp :: punteros a arrays 
Cpp :: static_cast 
Cpp :: deifine an object in C++ 
Cpp :: escribir texto c++ 
Cpp :: c++ string to vector using delimiter 
Cpp :: find the number of digits of a given integer n . 
Cpp :: c++ sigabrt 
Cpp :: Patrick and Shopping codeforces in c++ 
Cpp :: C++ thread header 
Cpp :: C++ if...else Statement 
Cpp :: random 1 diem tren man hinh bang dev c 
Cpp :: log like printf c++ 
Cpp :: Change Font ImGui 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =