#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;

int main ()
{
    char out_file_name[15];
    cout<<"Enter the name of your output file: ";
    cin>>out_file_name;

    ifstream input;
    ofstream output;

    cout<<"Begin editing files.\n";

    input.open("Input.txt");
    if (input.fail())
    {
        cout<<"Input file opening failed.\n";
        exit(1);
    }

    output.open("output.txt");
    if(output.fail())
    {
        cout<<"Output file opening failed.\n";
        exit(1);
    }


}

I need help with the continuation of this project. I'm asking for your help. These are the steps.

Read the input file.
Check if the input file exists and can be opened.
Get the name of the output file from the user (the name shouldn’t exceed 15
characters).
Invoke the necessary function calls to transpose, sub_matrix, determinant, inverse, and multiplication.
Print all information obtained to an output file.
Your output file should include the following for all input matrices
The original matrix.
The transpose of the original matrix.
The determinant of the original matrix.
The inverse of the original matrix (As long as the determinant is not zero).
The product of the original matrix and its inverse

Recommended Answers

All 8 Replies

Do you know how to calculate the transpose, sub_matrix, determinant, inverse, and multiplication of a matrix on paper? If now then you need to learn it now -- google for those terms and you will probably find wiki articles about them.

I have the equation for everything and I also have a matrix calculator but I don't understand how to out that into the program as a function. That is what I need help with.

First write the code that reads the input file into a matrix. What's the size of the matrix (rows and columns)? Or does the input file contain the number of rows and columns and your program is expected to dynamically create the matrix at runtime.

Post the contents of the input file.

The contents of the input file are:

2
1 0
0 1
3
8 9 1
3 5 2
-2 3 -1
0

We are assuming the largest matrix is 10x10

So how is that file supposed to be interpreted?

The file is the matrix. The program should generate an output file that contains the following :
1. The original matrix.
2. The transpose of the original matrix.
3. The determinant of the original matrix.
4. The inverse of the original matrix (As long as the determinant is not zero).
5. The product of the original matrix and its inverse.

A matrix usually has the same number of columns on each row, for example this is a 3x3 matrix

1  0  1
2  3  4
5  6  7

I can't tell what the numbers mean in the file you posted.

2.000 0.000 0.000
1.000 0.000 0.000
0.000 1.000 0.000
3.000 0.000 0.000
8.000 9.000 1.000
3.000 5.000 2.000
-2.000 3.000 -1.000
0.000 0.000 0.000

This is the matrix. Sorry the other file was unclear. This is the same file but in an easier way

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.