求本程序正解,以及为什么
程序代码:
#include<stdio.h> int main() { extern char Name[52]; int Number[52]; float Grade[52]; int index; for(index=0;index<=51;index++) { printf("No.%d's grade is:\n",Number[index+1]); scanf("%f",Grade[index]); } printf("Number Name Grade"); for(index=0;index<=51;index++) { printf("%d %c %f",Number[index+1],Name[index+1],Grade[index]); } return 0; }这是第一个文件,
程序代码:
#include<stdio.h> Name[1]="a"; Name[2]="s"; Name[3]="d"; Name[4]="Z"; Name[5]="f"; Name[6]="g"; Name[7]="X"; Name[8]="C"; Name[9]="V"; Name[10]="h"; Name[11]="j"; Name[12]="k"; Name[13]="l"; Name[14]=";"; Name[15]="'"; Name[16]="z"; Name[17]="x"; Name[18]="c"; Name[19]="v"; Name[20]="b"; Name[21]="n"; Name[22]="m"; Name[23]=","; Name[24]="."; Name[25]="/"; Name[26]="q"; Name[27]="w"; Name[28]="e"; Name[29]="r"; Name[30]="t"; Name[31]="y"; Name[32]="u"; Name[33]="i"; Name[34]="o"; Name[35]="p"; Name[36]="["; Name[37]="]"; Name[38]="\"; Name[39]="`"; Name[40]="A"; Name[41]="S"; Name[42]="D"; Name[43]="F"; Name[44]="G"; Name[45]="H"; Name[46]="J"; Name[47]="K"; Name[48]="L"; Name[49]="Q"; Name[50]="W"; Name[51]="E";这是第二个。
问题是:E:\visual c++ 6.0\text2.cpp(2) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(2) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [1]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(3) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(3) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(3) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [2]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(4) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(4) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(4) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [3]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(5) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(5) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(5) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [4]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(6) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(6) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(6) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [5]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(7) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(7) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(7) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [6]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(8) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(8) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(8) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [7]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(9) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(9) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(9) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [8]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(10) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(10) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(10) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [9]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(11) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(11) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(11) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [10]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(12) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(12) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(12) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [11]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(13) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(13) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(13) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [12]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(14) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(14) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(14) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [13]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(15) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(15) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(15) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [14]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(16) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(16) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(16) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [15]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(17) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(17) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(17) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [16]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(18) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(18) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(18) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [17]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(19) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(19) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(19) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [18]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(20) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(20) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(20) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [19]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(21) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(21) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(21) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [20]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(22) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(22) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(22) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [21]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(23) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(23) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(23) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [22]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(24) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(24) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(24) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [23]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(25) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(25) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(25) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [24]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(26) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(26) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(26) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [25]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(27) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(27) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(27) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [26]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(28) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(28) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(28) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [27]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(29) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(29) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(29) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [28]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(30) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(30) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(30) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [29]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(31) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(31) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(31) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [30]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(32) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(32) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(32) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [31]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(33) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(33) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(33) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [32]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(34) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(34) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(34) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [33]'
There is no context in which this conversion is possible
E:\visual c++ 6.0\text2.cpp(35) : error C2501: 'Name' : missing storage-class or type specifiers
E:\visual c++ 6.0\text2.cpp(35) : error C2369: 'Name' : redefinition; different subscripts
E:\visual c++ 6.0\text2.cpp(2) : see declaration of 'Name'
E:\visual c++ 6.0\text2.cpp(35) : error C2440: 'initializing' : cannot convert from 'char [2]' to 'int [34]'
error count exceeds 100; stopping compilation
执行 cl.exe 时出错.
这是怎么回事