level 5
float sn=100.0,hn=50.0;
for(int n=2;n<=10;n++)
{
sn=sn+2*hn;/*第n次落地时共经过的米数*/
hn=hn/2; /*第n次反跳高度*/
}
printf("第10次落地时,共经过%f米 \n",sn);
printf("第10次反弹%f米\n",hn);
-----错误提示如下-----
Compiling...
text_one.cpp
G:\text_one.cpp(9) : error C2018: unknown character '0xa1'
G:\text_one.cpp(9) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(12) : error C2018: unknown character '0xa1'
G:\text_one.cpp(12) : error C2018: unknown character '0xa1'
G:\text_one.cpp(15) : warning C4508: 'main' : function should return a value; 'void' return type assumed
G:\text_one.cpp(41) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
G:\text_one.cpp(41) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(42) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(43) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(44) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(49) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(51) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(53) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(55) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(57) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(59) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(70) : warning C4244: '=' : conversion from 'double' to 'long', possible loss of data
G:\text_one.cpp(71) : warning C4244: '=' : conversion from 'double' to 'long', possible loss of data
G:\text_one.cpp(157) : warning C4305: 'initializing' : truncation from 'const int' to 'char'
G:\text_one.cpp(157) : warning C4309: 'initializing' : truncation of constant value
G:\text_one.cpp(157) : warning C4305: 'initializing' : truncation from 'const int' to 'char'
G:\text_one.cpp(157) : warning C4309: 'initializing' : truncation of constant value
执行 cl.exe 时出错.
text_one.obj - 1 error(s), 0 warning(s)
2012年03月06日 14点03分
1
level 5
float sn=100.0,hn=50.0;
for(int n=2;n<=10;n++)
{
sn=sn+2*hn;/*第n次落地时共经过的米数*/
hn=hn/2; /*第n次反跳高度*/
}
printf("第10次落地时,共经过%f米 \n",sn);
printf("第10次反弹%f米\n",hn);
-----错误提示如下-----
Compiling...
text_one.cpp
G:\text_one.cpp(9) : error C2018: unknown character '0xa1'
G:\text_one.cpp(9) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(10) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(11) : error C2018: unknown character '0xa1'
G:\text_one.cpp(12) : error C2018: unknown character '0xa1'
G:\text_one.cpp(12) : error C2018: unknown character '0xa1'
G:\text_one.cpp(15) : warning C4508: 'main' : function should return a value; 'void' return type assumed
G:\text_one.cpp(41) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
G:\text_one.cpp(41) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(42) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(43) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(44) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(49) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(51) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(53) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(55) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(57) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(59) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
G:\text_one.cpp(70) : warning C4244: '=' : conversion from 'double' to 'long', possible loss of data
G:\text_one.cpp(71) : warning C4244: '=' : conversion from 'double' to 'long', possible loss of data
G:\text_one.cpp(157) : warning C4305: 'initializing' : truncation from 'const int' to 'char'
G:\text_one.cpp(157) : warning C4309: 'initializing' : truncation of constant value
G:\text_one.cpp(157) : warning C4305: 'initializing' : truncation from 'const int' to 'char'
G:\text_one.cpp(157) : warning C4309: 'initializing' : truncation of constant value
执行 cl.exe 时出错.
text_one.obj - 1 error(s), 0 warning(s)
2012年03月06日 14点03分
2
level 9
9 - 15 行 复制粘贴 带进来中文的或者它编码的 空格、等 空白字符 请删一删
2012年03月06日 14点03分
3
level 5
没有用,原来的
float sn=100.0,hn=sn/2;
int n;
for(n=2;n<=10;n++)
{
sn=sn+2*hn;/*第n次落地时共经过的米数*/
hn=hn/2; /*第n次反跳高度*/
}
printf("the total of road is %f\n",sn);
printf("the tenth is %f meter\n",hn);
也是报错...
2012年03月08日 03点03分
5
level 5
没啊,书里给出的代码例子,也是报错,我只是把输出的部分换成了中文而已,代码都没改
2012年03月08日 03点03分
6
level 7
你的代码里面有全角符号。换成半角符号就没问题了。
float sn=100.0,hn=sn/2;
int n;
for(n=2;n<=10;n++){
sn=sn+2*hn;/*第n次落地时共经过的米数*/
hn=hn/2; /*第n次反跳高度*/
}
printf("the total of road is %f\n",sn);
printf("the tenth is %f meter\n",hn);
2012年03月08日 03点03分
7