please help to with this program by mainly using arrays and pointers ,... i need this program to check 2 matrix files "if they contain any character and if they contain cout<<"invalid"; " and to open them from .txt file
Help with Code Tags
cplusplus Syntax (Toggle Plain Text)
1.
#include<iostream>
2.
#include<fstream>
3.
#include<string>
4.
#include<cmath>
5.
using namespace std;
6.
7.
int main()
8.
{
9.
char y, n;
10.
ifstream file1;
11.
ifstream file2;
12.
string filename1;
13.
string filename2;
14.
string c;
15.
int number;
16.
int choice;
17.
18.
cout<<"xxxxxxx matrix calculator \n";
19.
cout<<"please choose from the following menu :\n";
20.
21.
while(choice!=8&&choice==n)
22.
{
23.
cout<<"1. matrix addition\n";
24.
cout<<"2. matrix subtraction\n";
25.
cout<<"3. matrix multiplication\n";
26.
cout<<"4. matrix transpose\n";
27.
cout<<"5. checking matrix equality\n";
28.
cout<<"6. check matrix properties\n";
29.
cout<<"7. matrix power\n";
30.
cout<<"8. exit\n";
31.
cout<<"please enter your choice\n";
32.
cin>>choice;
33.
34.
while(//condition when there is character)// for the first file and the second one :D
35.
{
36.
cout<<"invalid file!!\n";
37.
cout<<"do you want to continue (y) or return to menu(n)\n";
38.
/* "y" to continue to try to enter the file name again & "n" to go back to the menu*/
39.
cin>>choice1;
40.
if(choice1=='y')
41.
{
42.
cout<<"please enter the first filename\n";
43.
cin>>filename1;
44.
file1.open(filename1.c_str(),ios::in);
45.
46.
if(!file1.fail())
47.
{
48.
cout<<"good\n";
49.
break;
50.
}
51.
}
52.
else if(choice1=='n')
53.
{
54.
cout<<"assdasdasdad\n";
55.
break;
56.
}
57.
}
58.
59.
60.
61.
switch(choice)
62.
{
63.
case 1 :
64.
65.
case 2 :
66.
67.
case 3 :
68.
69.
case 4 :
70.
71.
case 5 :
72.
73.
case 6 :
74.
75.
case 7 :
76.
77.
case 8 :
78.
cout<<"thank you for using my program\n";
79.
exit(1);
80.
}
81.
82.
system ("pause");
83.
return 0;
84.
}
85.
}