![]() |
#2
peach54602014-01-22 13:50
|
程序清单:
//num_test.cpp--use numeric test in for loop
#include<iostream>
int main()
{
using namespace std;
cout << "Enter the starting countdown value: ";
int limit;
cin >> limit;
int i;
for (i = limit; i; i--) //quits when i is 0
cout << "i= " << i << "\n";
cout << "Done now that i= " << i << "\n";
return 0;
}
请问:为什么循环在i变为0后结束?
谢谢!