#include <bits/stdc++.h>
using namespace std;
#define HODOR long long int
#define INF 1234567890
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define dwn(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(c, it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define DWN(c, it) for(typeof((c).end()) it = (c).end()-1; it >= (c).begin(); --it)
#define ss(n) scanf("%s",n)
#define FILL(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mp make_pair
#define ALL(v) v.begin(), v.end()
#define sz(a) ((int)a.size())
#define SET(v, i) (v | (1 << i))
#define TEST(v, i) (v & (1 << i))
#define TOGGLE(v, i) (v^(1 << i))
#define gc getchar
#define pc putchar
template<typename X> inline void inp(X &n) {
register int ch=gc();int sign=1;n=0;
while(ch < '0' || ch > '9'){if(ch=='-')sign=-1; ch=gc();}
while( ch >= '0' && ch <= '9') n = (n<<3)+(n<<1) + ch-'0', ch=gc();
n=n*sign;
}
inline void inps(char *n) {
register int ch=gc();
int sign=1;
int i=0;
while(ch != '\n'){ n[i]=(char)ch; ++i; ch=gc();}
n[i]='\0';
}
int MaxPath(int arr[][100],int n) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cout<<arr[i][j]<<" ";
}
cout<<endl;
}
}
int main() {
int t,n;
inp(t);
while(t--) {
inp(n);
int arr[n][n];
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
inp(arr[i][j]);
}
}
float result = MaxPath(arr,n);
}
return 0;
}
Error seems like this : error: cannot convert ‘int ()[n]’ to ‘int ()[100]’ for argument ‘1’ to ‘int MaxPath(int (*)[100], int)’傳遞一個多維數組在C++
我看到的stckoverflow很多帖子,但沒有一個似乎工作
我強烈建議您使用文本編輯器的片段功能而不是這些宏。這些按位可能很容易變成函數而不是宏,或者你可以使用'std :: bitset'。 – chris
好吧,thnx爲 –
代碼現在很好地縮進 –