#include "stdafx.h"
#include<iostream>
using namespace std;
int a;
int b;
int n;
int _tmain(int argc, _TCHAR* argv[])
{
loop:
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;
goto loop;
return 0;
}
#include<iostream>
using namespace std;
int a;
int b;
int n;
int _tmain(int argc, _TCHAR* argv[])
{
loop:
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;
goto loop;
return 0;
}
200字以内,仅用于支线交流,主线讨论请采用回复功能。