给i传一个值,使while(i!=!)成为死循环
来源:百度知道 编辑:UC知道 时间:2024/05/24 08:59:50
题: 给i传一个值,使while(i!=!)成为死循环
是一道考研题
是一道考研题
i 限制数据类型么?
如果不限制类型,可以用一个很简单的笨办法。
class specailClass
{
public:
bool operator !=( const specailClass& right )
{
return true;
}
};
void main()
{
specailClass i;
while( i != i )
{
//do some thing
}
}
楼下的还是有可能会生成两个相现的随机数的,可以改成这样
int specailFunction()
{
static int value = 0;
return value ++;
}
#define i specailFunction()
void main()
{
while( i != i )
{
//do some thing
printf( "1\n" );
}
}
写错了吧
可以试试给他系统的时钟
//这个才是最简单的办法 ,给 i 一个 随机数
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
srand( (unsigned)time( NULL ) );
#define i rand()
while( i != i )
{
cout<<"yes i am true ! "<<endl;
}
}
#include<std
给i传一个值,使while(i!=!)成为死循环
while(i = 0)
while( str[i++] ) 是什么意思?
C语言中:int i=0;执行语句while(i++<4)后;i的值是什么啊?为什么?
while I was doing可省略I was吗
4.While I ___ TV, the telephone_____.
I ___the new words while you ____
给my wife is cooking while I was working in the garden.找错
i think i 谁有韩文的? 给我一个谢谢啦....
i=0;k=10;while(i=8) i=k--执行多少次?