标题:[求助]
只看楼主
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



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




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

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