谭叔叔说要少用goto,除非迫不得已。。。。会打乱结构的
#include "stdafx.h"
#include<iostream>
using namespace std;
int a;
int b;
int n;
int _tmain(int argc, _TCHAR* argv[])
{
while(1) {
n=1;
cout<<"请输入检测数字:";
cin>>a;
cout<<"\\n";
while(a!=1){
if(a%2==0)
a=a*0.5;
else
a=(a*3+1)/2;
cout<<"第"<<n<<"个数:"<<a<<"\\t";
n++;
};
cin>>b;
}
return 0;
}