I want to know how to develop a matrix calculator that preforms basic matrix operations usin g arrays and/or pointers. Iwant a calculator to do addition ,subtraction ,multiplication ,transpose,checking enquality, checking properties and matrix power & the program will read the data from a file & check if the data is integer or character 7 the file name must have the dimension(.mat) .i did that part i added the dimension(.mat) to the file name but the file don't open so please anyone who can help me in how to do that or give me the code or parts of it today or tomorrow. i'll be graetfull & thanks in advance .

Please post your code, then someone might be able to give some help. We don't do your work for you.

Take it one piece at a time. Your project is not a trivial assignment - get the easy parts working then move up to the next parts.

ok . here is the part of opening the file after adding to it the dimension(.mat)

# include <iostream>
# include <string>
# include <fstream>
using namespace std;
int main()
{
	ifstream myfile ;
	string filename;
	string x(".mat");
	cout<<"please enter the first matrix file name\n";
	cin>>filename;
	filename.append(x);
	cout<<filename<<endl;
    myfile.open(filename.c_str(),ios::in);
	if(myfile.fail())
	{
	cout<<"invaild file !! \n";
	}
	return 0; 
}

please tell what's wrong in it

Attachments
# include <iostream>
# include <string>
# include <fstream>
using namespace std;
int main()
{
	ifstream myfile ;
	string filename;
	string x(".mat");
	cout<<"please enter the first matrix file name\n";
	cin>>filename;
	filename.append(x);
	cout<<filename<<endl;
    myfile.open(filename.c_str(),ios::in);
	if(myfile.fail())
	{
	cout<<"mayenfa3sh ya user ya habibi  \n";
	cout<<"invaild file !! \n";
	}
	return 0; 
}

So far, nothing is wrong. Assuming the user enters just the name portion of the file name (like "file1" ), then your program appends the ".mat" to it.

Now, allocate arrays to store data, and read from the file.

i read the matrixes that i will work on from a file so i need an input file & then they will appear on the console then their addition will appear.
as an example :
matrix1.mat //name of file
//what the file contains
1 2
3 4
matrix2.mat //file name 2
//what the file contains
0 1
4 5
//what will appear on the console as this :
1 2
3 4
+
0 1
4 5
=
1 3
7 9

This article has been dead for over six months. Start a new discussion instead.