C++入门经典-例3.17-使用while循环进行计算
1:代码如下:
// 3.17.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
void main()
{
int i=0,j=0;
cout << "执行while前j=" << j << endl;
while(i>1)
{
j++;
}
cout << "执行while后j=" << j << endl;
}
View Code
运行结果: