| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 439 人关注过本帖
标题:[求助]
只看楼主 加入收藏
hyk2005
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-9-28
收藏
 问题点数:0 回复次数:0 
[求助]
#include "stdio.h"
#include "stdlib.h"
int times=0;
int Total_Num;
void OutTeam(Buffer,Num)
int *Buffer;
int Num;
{int i;
 for (i=0;i<Num;i++)
  printf("%3d",Buffer[i]);
 printf("\n");
 times++;
}
void MovePosition(Position,DesNum,Buffer)
int Position,DesNum;
int *Buffer;
{Buffer[Position]=DesNum;
 OutTeam(Buffer,Position+1);
 }
void SubAssign(Buffer,Position,Orig_Value,DesValue,Standard)
int *Buffer;
int Position,Orig_Value,DesValue,Standard;
{
 if ((Position==Standard-1)&&(Orig_Value<=DesValue))
  {MovePosition(Position,Orig_Value,Buffer);
   SubAssign(Buffer,Position,++Orig_Value,DesValue,Standard);
  }
 else
 {
  while(Orig_Value<=DesValue)
  {Buffer[Position]=Orig_Value;
   SubAssign(Buffer,Position+1,Buffer[Position]+1,Total_Num-(Standard-1-(Position+1)),Standard);
   Orig_Value++;
  }
 }
}
void main(void)
{int Standard;
 int *Buffer;
 int i,OrigPosition=0;
 fprintf(stderr,"\nHow many numbers do you want to assign\nTotal_Num=");
 scanf("%d",&Total_Num);
 fprintf(stderr,"\nWhich numbers do you want to assign in a team\nStandard=");
 scanf("%d",&Standard);
 printf("\n");
 Buffer=calloc(Standard,sizeof(int));
 for (i=0;i<Standard;i++)
  Buffer[i]=i+1;
 SubAssign(Buffer,OrigPosition,Buffer[OrigPosition],Total_Num-(Standard-1-OrigPosition),Standard);
 free(Buffer);
 fprintf(stderr,"\ttimes=%d",times);
}
要从输出的数中选出几组自己需要的,怎么办?是不是要用指针?
请各位指点迷津
搜索更多相关主题的帖子: include 
2005-09-29 12:45
快速回复:[求助]
数据加载中...
 
   



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

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