cout中的未知编译器错误,从理论上讲,它是有效的

问题描述 投票:0回答:1
#include <iostream>
using namespace std;

void matrice(int n){
int D[n][n];
cout<<"Input the number of the elements "<<endl;
cin>>n;
cout<<"Input the elements :";
for(int i=0;i<n;i++){
  for(int j=0;j<n;j++){
        cin>>D[i][j];

  }
}
for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
            if(int min=0>D[i-1][j-1]){
        D[i-1][j-1]=min;
    }
    }
}
cout<<" The smallest element is : "<< min<<"and it is the"<< i <<" element ."  ;
}


int main(){
int i, min ,j,n;

int n1;
    cout<<"Decide: "<<endl;
    cout<<"Matrice[1]"<<"\t"<<"Vekcor[2]"<<endl;
cin>>n1;
if(n1==1){
    matrice(n);
}
else if(n1==2){
}
}

问题出在cout的第22行,它给出了以下消息:C:\ Users \ use \ Documents \ Dev C ++ \ void_vektor.cpp | 22 |错误:'operator <

c++ operators void
1个回答
0
投票

主要问题是您在for循环中声明了min,它将在循环退出时超出范围。

© www.soinside.com 2019 - 2024. All rights reserved.