我想写一个重申的条件
if (BOX_H1(1) && BOX_H1(2) && BOX_H1(3) && BOX_H1(4) && BOX_H1(5) && BOX_H1(6) && BOX_H1(7) && BOX_H1(8);)在for循环形式中,如下所示:
if (
for (int x=1;x<=7; x++)
{
(BOX_H1(x));
})其中,BOX_H1(1) si是一个接受int (shift参数)的布尔函数,但是这段代码不能工作。
有人知道我该怎么写吗?
编辑:我的代码在以下表格中:
bool Buy_H1 =0, ...
..。
if(Buy_H1) {if(...)}
..。
void Entry()
{
Buy_H1 =BOX_H1(1) && BOX_H1(2) && BOX_H1(3) && BOX_H1(4) &&
BOX_H1(5) && BOX_H1(6) && BOX_H1(7) && BOX_H1(8) ;
}如果,代替最后的代码,我将
void Entry()
{
bool Buy_H1(const int parameter){
for(int i=1; i<=parameter; i++){
if(!BOX_H1(i))
return false; }
return true; }
}我到达'Buy_H1' - function can be declared only in the global scope
发布于 2017-09-23 17:57:45
bool booleanFunction( const int parameter ){
for( int i = 1; i <= parameter; i++ ){
if ( !BOX_H1( i ) )
return false;
}
return true;
}
void OnStart(){
...
if ( booleanFunction( 8 ) ){
Print( "OK" );
} //edited, your code instead of this
...
}https://stackoverflow.com/questions/46380255
复制相似问题