c++问题帮助
# include <iostream.h>
#include<math.h>
int main()
{
int a,b,c,e,f;
for(a=-999,(int)b=a/100,int(c)=(a%100)/10,(int)e=a%10;(-999)=<a<=(-100)||100=<a<=999; a++);
if (a=pow(b,3)+pow(c,3)+pow(e,3))
cout<<a<<endl;
}
F:\软件\新建文件夹 (2)\MyProjects\爱相\sieng.cpp(9) : error C2059: syntax error : '<'
F:\软件\新建文件夹 (2)\MyProjects\爱相\sieng.cpp(9) : error C2143: syntax error : missing ';' before ')'
F:\软件\新建文件夹 (2)\MyProjects\爱相\sieng.cpp(11) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
F:\软件\新建文件夹 (2)\MyProjects\爱相\sieng.cpp(18) : warning C4508: 'main' : function should return a value; 'void' return type assumed
[解决办法]
很多基本语法都有问题,以下可以编译,不过逻辑部分还需要自己修改:
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char* argv[])
{
int a,b,c,e,f;
for(a=-999,b=a/100,c=(a%100)/10,e=a%10;((-999)<=a && a<=(-100))
[解决办法]
(100<=a && a<=999); a++)
if (a=pow(b,3)+pow(c,3)+pow(e,3))
cout<<a<<endl;
return 0;
}
# include <iostream>
#include<math.h>
using namespace std;
int main()
{
int a,b,c,e,f;
a = -999;
b = -999/100;
c = ( a % 100 ) / 10;
e = a % 10;
while ( (-999 <= a && a >= -100)
[解决办法]
(100 <= a && a >= 999) ) a++;
a = pow( b, 3 ) + pow( c, 3 ) + pow( e, 3 );
cout << a << endl;
}