#9721: 到底是以0還是-1結束啊?


zxkyjimmy (夜)


#include <iostream>
using namespace std;
int main()
{
    int t, x=1, a[15]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384};
    while (cin >> t&&t!=-1)
    {
        int i;
        for (i=0; i<15; i++)
            if(a[i]>=t)
                break;
        cout << "Case " << x++ << ": " << i << endl;
    }
    return 0;
}
此時的結果OLE(輸出題目未要求文字Case 10001: 0)
可是將while的判斷後面改成t>0再去跑卻得到AC......
這樣到底是-1停還是0停=_= 
#9722: Re:到底是以0還是-1結束啊?


zxkyjimmy (夜)


 
沒事了,是負數停下來><