C++ 有人能解释一下为什么我会;表达式必须具有指向对象类型“的指针”;在以下代码中: #包括 #包括 #包括 使用名称空间std; int main(){ 系统(“cls”); int n,l,m; INTA[100][100]、b[100][100]、m[10
有人能解释一下为什么我会;表达式必须具有指向对象类型“的指针”;在以下代码中:C++ 有人能解释一下为什么我会;表达式必须具有指向对象类型“的指针”;在以下代码中: #包括 #包括 #包括 使用名称空间std; int main(){ 系统(“cls”); int n,l,m; INTA[100][100]、b[100][100]、m[10,c++,C++,有人能解释一下为什么我会;表达式必须具有指向对象类型“的指针”;在以下代码中: #包括 #包括 #包括 使用名称空间std; int main(){ 系统(“cls”); int n,l,m; INTA[100][100]、b[100][100]、m[100][100]; //输入 您的代码以前很少有小错误,比如缺少}。在这里,我已经纠正了它 #include<iostream> #include<conio.h> #include<array> using
#包括
#包括
#包括
使用名称空间std;
int main(){
系统(“cls”);
int n,l,m;
INTA[100][100]、b[100][100]、m[100][100];
//输入
您的代码以前很少有小错误,比如缺少}
。在这里,我已经纠正了它
#include<iostream>
#include<conio.h>
#include<array>
using namespace std;
int main(){
system("cls");
int n, l, m;
int a[100][100], b[100][100], m[100][100];
//inputing
cout<<"For the multiplication of the matrices NxL & LxM: \n";
cout<<"Enter N: ";
cin>>n;
cout<<"Enter L: ";
cin>>l;
cout<<"Enter M: ";
cin>>m;
cout<<"Enter the first matrix: ";
for(int i=0; i<n; i++){
for(int j=0; j<l; j++){
cout<<i<<":";
cin>>a[i][j];
}
cout<<" \n";
}
cout<<"Enter the second matrix: ";
for(int i=0; i<l; i++){
for(int j=0; j<m; j++){
cout<<i<<":";
cin>>a[i][j];
}
cout<<" \n";
}
//multiplying
for(int i=0; i<n; i++)
for(int j=0; j<l; j++){
m[i][j] = a[i][j]*b[j][i]);
}
}
getch();
system("cls");
return 0;
}
#包括
#包括
#包括
使用名称空间std;
int main(){
系统(“cls”);
int n,l,m;
int a[100][100]、b[100][100]、ar[100][100];
//输入
您的代码以前很少有小错误,比如缺少}
。在这里,我已经纠正了它
#include<iostream>
#include<conio.h>
#include<array>
using namespace std;
int main(){
system("cls");
int n, l, m;
int a[100][100], b[100][100], m[100][100];
//inputing
cout<<"For the multiplication of the matrices NxL & LxM: \n";
cout<<"Enter N: ";
cin>>n;
cout<<"Enter L: ";
cin>>l;
cout<<"Enter M: ";
cin>>m;
cout<<"Enter the first matrix: ";
for(int i=0; i<n; i++){
for(int j=0; j<l; j++){
cout<<i<<":";
cin>>a[i][j];
}
cout<<" \n";
}
cout<<"Enter the second matrix: ";
for(int i=0; i<l; i++){
for(int j=0; j<m; j++){
cout<<i<<":";
cin>>a[i][j];
}
cout<<" \n";
}
//multiplying
for(int i=0; i<n; i++)
for(int j=0; j<l; j++){
m[i][j] = a[i][j]*b[j][i]);
}
}
getch();
system("cls");
return 0;
}
#包括
#包括
#包括
使用名称空间std;
int main(){
系统(“cls”);
int n,l,m;
int a[100][100]、b[100][100]、ar[100][100];
//输入
可能的原因是您有一个名为m
的int
和一个int[100][100]
称为m
。为变量指定有意义的名称,而不仅仅是单个字符。首先,为什么将“m”声明为int数组以及int类型变量?您需要首先查看第一个错误。问题已经出现在第9行:。发布问题时,请包含完整的错误消息,而不仅仅是o部分Fit@Aayush,有点偏离正轨的评论--获得一个更好的开发环境。看起来您使用的是旧的DOS-C环境。最好是开始研究linux/gcc环境。一个可能的原因是您有一个名为m
的int
和一个int[100][100]
称为m
。为变量指定有意义的名称,而不仅仅是单个字符。首先,为什么将“m”声明为int数组以及int类型变量?您需要首先查看第一个错误。问题已经出现在第9行:。发布问题时,请包含完整的错误消息,而不仅仅是o部分Fit@Aayush,有点偏离正轨的评论--获得一个更好的开发环境。看起来你正在使用旧的DOS-C环境。最好是开始研究linux/gcc环境。我在写了这段代码后得到了答案。但是仍然非常感谢你,兄弟!@Aayus Gupta Welcome我在写了这段代码后得到了答案。但是仍然非常感谢你呃!@Aayush Gupta欢迎你