PracticeDev/study_cpp/cpp_primer_source_code/Chapter 5/num_test.cpp

17 lines
407 B
C++
Raw Permalink Normal View History

2022-12-20 17:31:11 +08:00
// 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";
// cin.get();
// cin.get();
return 0;
}