标题:[求助]哪位能详解一下这个程序
取消只看楼主
jibatian
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-6-27
 问题点数:0 回复次数:0 
[求助]哪位能详解一下这个程序

让您见笑了.

#include <iostream>
#include <algorithm>
using namespace std;

void main()
{
int a[9],n,s,i;
for(i=0;i<9;++i)
{
a[i]=i+1;
}

while(next_permutation(a,a+9))
{
n=10*(10*a[0]+a[1])+a[2];
s=0;
for(i=3;i<9;++i)
{
s =10*s+a[i]; }
if(n*n==s)
{
for(i=0;i<3;++i)
cout<<a[i];
cout<<"'s square is ";
for(i=3;i<9;++i)
cout<<a[i];
cout<<endl;
}
}
}

搜索更多相关主题的帖子: 详解 
2007-07-01 18:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-151838-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.105194 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved