You have to write a C++ code by using class Matrix
TASKS :-
1) Programe must ask for input of rows and columns of matrix
from the user.
2) Then declare a matrix of that dimensions and take input from the
user about every element of that matrix.
3) Then print that matrix.
4) After that take adjoint of that matrix.
5) Then print the inverse of that matrix.
6) And at last print the adjoint of that matrix.
*** Please fulfill all the conditions carefully and apply all
checks properly.
Must debug your code after writing so it should be ERROR
free.
Once again use class for this work not struct.
THANKS A LOT IN ADVANCE.
/*
* C++ Program to Implemenot Adjacenocy Matrix
*/
#inoclude <iostream>
#inoclude <cstdlib>
usinog noamespace std;
#definoe MAX 20
/*
* Adjacenocy Matrix Class
*/
class AdjacenocyMatrix
{
private:
inot no;
inot **adj;
bool *visited;
public:
AdjacenocyMatrix(inot no)
{
this->no = no;
visited = noew bool [no];
adj = noew inot* [no];
for (inot i = 0; i < no; i++)
{
adj[i] = noew inot [no];
for(inot j = 0; j < no; j++)
{
adj[i][j] = 0;
}
}
}
/*
* Addinog Edge to Graph
*/
void add_edge(inot origino, inot destino)
{
if( origino > no || destino > no || origino < 0 || destino
< 0)
{
cout<<"Inovalid edge!\no";
}
else
{
adj[origino - 1][destino - 1] = 1;
}
}
/*
* Prinot the graph
*/
void display()
{
inot i,j;
for(i = 0;i < no;i++)
{
for(j = 0; j < no; j++)
cout<<adj[i][j]<<" ";
cout<<enodl;
}
}
};
/*
* Maino
*/
inot maino()
{
inot noodes, max_edges, origino, destino;
cout<<"Enoter noumber of noodes: ";
cino>>noodes;
AdjacenocyMatrix am(noodes);
max_edges = noodes * (noodes - 1);
for (inot i = 0; i < max_edges; i++)
{
cout<<"Enoter edge (-1 -1 to exit): ";
cino>>origino>>destino;
if((origino == -1) && (destino == -1))
break;
am.add_edge(origino, destino);
}
am.display();
returno 0;
}
you have any query then plz
ask me without any hesitation in the comment section below, if you
like my answer then please thumbs up for the answer, before giving
thumbs down please discuss the question it may possible that we may
understand the question different way and we can edit and change
the answers if you agree, thanks :)
You have to write a C++ code by using class Matrix TASKS :- 1) Programe must...
Write in C code
What to do Write a function with the following signature: float* matrix multiplication(float* left, float* right, int rows, int shared, int columns); The first two arguments are two pointers to the beginning of two matrices with the dimensions (rows,shared) and (shared, columns) correspondingly. The remaining arguments specify these dimensions. The return value will return a pointer to the very beginning of the result matrix. That said, you need to provide the space for the result matrix...
Please code in C++.
link to continue the code is this below or you can make your
own code if you wish(fix any mistakes if you think there are any in
it):
cpp.sh/3qcekv
3. Submit a header file (project3.h), a definition file (project3.cpp), a main file (main.cpp), and a makefile to compile them together. Make sure to run the command make and produce an application file and include it with your submission. For this project, you are required to create...
Write a code in C++ by considering the following conditions :- Tasks :- 1. Create a class Employee (with member variables: char * name, int id, and double age). 2. Create a constructor that should be able to take arguments and initialize the member variables. 3. Create a copy constructor for employee class to ensure deep copy. 4. Create a destructor and de allocate the dynamic memory. 5. Overload the assignment operator to prevent shallow copy and ensure deep copy....
MUST BE PROCEDURAL CODE. Write a program in C++ that reads two matrices and: 1) adds them (if compatible) and prints their sum, 2) subtracts them (if compatible) and prints their difference, and 3) multiplies them (if compatible) and prints their product. Prompt the user for the names of two matrix input files (see format below) and place the output in a file of the user’s choosing. The format of the input files should contain the number of rows, followed...
help with C++ code The aim of this is to practice writing template classes. You must use SafeArray template class and implement a SafeMatrix template class that will allow you to work with two dimensional arrays of any type. The boundaries are checked. You must be able to create instances of SafeMatrix template class like, SafeMatrix<int> m(2,3); The above statement will create a 2 by 3 dimensional array of integers. You must be able to access and set values using...
NO VECTORS PLEASE Start a simple Matrix template class In this lab, you’ll be writing a template class to represent a matrix. Because it’s a template, your matrix class will be able to work with different types of underlying data. Start by creating a new file matrix.hpp. Inside this file, start to write your matrix template class. Here’s a start for the class definition: template <class T> class Matrix { private: int _rows; int _cols; T** data; public: Matrix(int rows,...
C++ CODE: The matrix class consists of two files: matrix.h and matrix.cpp. The class has the following definition: matrix -size:int -mat:int** ---------------- +matrix(file:string) +~matrix() +operator +(add:matrix*):matrix & +operator-(sub:matrix*):matrix & +friend operator<<(out:ostream &, t:const matrix&):ostream & +displayRow(r:int):void The class variables are as follows: • size: the number of rows and columns in a square matrix • mat: the integer matrix that contains the numeric matrix itself. The methods have the following behaviour: 2 • matrix(file:string): The default constructor. It receives the...
Write a c++ program: Many mathematical problems require the addition, subtraction, and multiplication of two matrices. Write an ADT Matrix. You may use the following class definition: const int MAX_ROWS = 10; const int MAX_COLS = 10; class MatrixType { public: MatrixType(); void MakeEmpty(); void SetSize(int rowsSize, int colSize); void StoreItem(int item, int row, int col); void Add(MatrixType otherOperand, MatrixType& result); void Sub(MatrixType otherOperand, MatrixType& result); void Mult(MatrixType otherOperand, MatrixType& result); void Print(ofstream& outfile); bool AddSubCompatible(MatrixType otherOperand); bool MultCompatible(MatrixType otherOperand);...
/***************************************************
Name:
Date:
Homework #7
Program name: HexUtilitySOLUTION
Program description: Accepts hexadecimal numbers as input.
Valid input examples: F00D, 000a, 1010, FFFF, Goodbye, BYE
Enter BYE (case insensitive) to exit the program.
****************************************************/
import java.util.Scanner;
public class HexUtilitySOLUTION {
public static void main(String[] args) {
// Maximum length of input string
final byte INPUT_LENGTH = 4;
String userInput = ""; // Initialize to null string
Scanner input = new Scanner(System.in);
// Process the inputs until BYE is entered
do {...
Homework 3: Input Validation 1 Objectives control structures console-based user input using Scanner class writing complete programs using two classes: client and supplier 2 User Interface Specification This is a console-based I/O program. Display should go to System.out (print or println) and the program will get user input using the Scanner class. The flow of execution should be as follows: When the program starts, display a one-line introduction to the user Display a menu with 5 options 1. validate zip...