程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> 編程錯誤-求教各位大神 下面這幾行代碼除去實現功能不看 有哪些編程上的硬傷(無法運行)

編程錯誤-求教各位大神 下面這幾行代碼除去實現功能不看 有哪些編程上的硬傷(無法運行)

編輯:編程解疑
求教各位大神 下面這幾行代碼除去實現功能不看 有哪些編程上的硬傷(無法運行)

#include
#include
#define maxn 10
#define maxm 10
int a[maxm][maxn];
int main()
{
int m,n,a,b;
scanf("%d",&b);
memset(a,0,sizeof(a));
a[0][b-1]=1;
int m=0;
for(i=1;i<=n*n;i++,n--)
{while(m<=b&&a[m][n-1]=0) {a[m][n]=i;m++;}
m=m-1;
while(n>=1&&a[m][n-1]=0) {a[m][n]=i;n--;}
n=n+1;
while(m>=0&&a[m][n-1]=0) {a[m][n]=i;m--;}
m=m+1;
while(n+1<b&&a[m][n-1]=0){a[m][n]=i;n++;}
n=n-1;
}
for(m=1,b=1;m<=n;m++)
for(;b<=m;b++)
printf("%s",a[m][b];)
return 0;}
** 這是報錯代碼**
:\C 語言\CodeBlocks\Debug\Cpp1.cpp(10) : error C2664: 'memset' : cannot convert parameter 1 from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(11) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(11) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(11) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(12) : error C2086: 'm' : redefinition
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(13) : error C2065: 'i' : undeclared identifier
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(14) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(14) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(14) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(14) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(14) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(14) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(16) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(16) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(16) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(16) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(16) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(16) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(18) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(18) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(18) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(18) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(18) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(18) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(20) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(20) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(20) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(20) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(20) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(20) : error C2106: '=' : left operand must be l-value
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(25) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(25) : error C2109: subscript requires array or pointer type
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(25) : error C2143: syntax error : missing ')' before ';'
D:\C 語言\CodeBlocks\Debug\Cpp1.cpp(25) : error C2059: syntax error : ')'
執行 cl.exe 時出錯.

Cpp1.exe - 1 error(s), 0 warning(s)

最佳回答:


a[m][n-1]=0
這類的都是不對的,這個屬於賦值,不屬於比較,應該兩個==

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved