C/C++の宿題を片付けます 53代目
■ このスレッドは過去ログ倉庫に格納されています
0554デフォルトの名無しさん
2005/11/26(土) 01:21:58#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _PROFILE{
char name[32];
double height;
struct _PROFILE* next;
}profile;
profile* add(char* _str,double d){
if(strlen(_str)>32)return NULL;
profile* p = (profile*)malloc(sizeof(profile));
strcpy(p->name,_str);
p->height = d;
p->next = NULL;
return p;}
int remove(profile* p){if(p!=NULL){if(p->next!=NULL)remove(p);free(p);}}
void minmax(profile* p){
if(p!=NULL){
int c=0;profile *min=p,*max=p;
while(p!=NULL){
if(min->height > p->height)min=p;
if(max->height < p->height)max=p;
c++;
p = p->next;}
printf("入力は%d人です.\n",c);
printf("一番低い人は%sさん %gセンチです.\n",min->name,min->height);
printf("一番高い人は%sさん %gセンチです.\n",max->name,max->height); }}
■ このスレッドは過去ログ倉庫に格納されています