| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 809 人关注过本帖
标题:爱因斯坦的问题,各位进来做一下
只看楼主 加入收藏
uncupid
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-5-16
收藏
 问题点数:0 回复次数:6 
爱因斯坦的问题,各位进来做一下

已知:
1、在一条街上,有5座房子,喷了5种颜色。
  2、每个房里住着不同国籍的人
  3、每个人喝不同的饮料,抽不同品牌的香烟,养不同的宠物

 问题是:谁养鱼?

  提示:
  1、英国人住红色房子
  2、瑞典人养狗
  3、丹麦人喝茶
  4、绿色房子在白色房子左面
  5、绿色房子主人喝咖啡
  6、抽Pall Mall 香烟的人养鸟
  7、黄色房子主人抽Dunhill 香烟
  8、住在中间房子的人喝牛奶
  9、 挪威人住第一间房
  10、抽Blends香烟的人住在养猫的人隔壁
  11、养马的人住抽Dunhill 香烟的人隔壁
  12、抽Blue Master的人喝啤酒
  13、德国人抽Prince香烟
  14、挪威人住蓝色房子隔壁
  15、抽Blends香烟的人有一个喝水的邻居

[此贴子已经被作者于2006-5-16 20:05:33编辑过]

搜索更多相关主题的帖子: 爱因斯坦 
2006-05-16 20:05
uncupid
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-5-16
收藏
得分:0 
原程序(头文件)

/************************************************************************/
/* 已知:
1、在一条街上,有5座房子,喷了5种颜色。
  2、每个房里住着不同国籍的人
  3、每个人喝不同的饮料,抽不同品牌的香烟,养不同的宠物

 问题是:谁养鱼?

  提示:
  1、英国人住红色房子
  2、瑞典人养狗
  3、丹麦人喝茶
  4、绿色房子在白色房子左面
  5、绿色房子主人喝咖啡
  6、抽Pall Mall 香烟的人养鸟
  7、黄色房子主人抽Dunhill 香烟
  8、住在中间房子的人喝牛奶
  9、 挪威人住第一间房
  10、抽Blends香烟的人住在养猫的人隔壁
  11、养马的人住抽Dunhill 香烟的人隔壁
  12、抽Blue Master的人喝啤酒
  13、德国人抽Prince香烟
  14、挪威人住蓝色房子隔壁
  15、抽Blends香烟的人有一个喝水的邻居 */
/************************************************************************/

#ifndef _EINSTEN__H
#define _EINSTEN__H

#include "stdio.h"
#include "stdlib.h"


#define Number 5

typedef enum _NATIONALITY_ENUM_
{
Britisher = 1,
Swede,
Dane,
German,
Norwegian,
}NATIONALITY_ENUM;

typedef enum _HOUSE_COLOR_ENUM_
{
Red = 1,
White,
Blue,
Green,
Yellow,
}HOUSE_COLOR_ENUM;

typedef enum _PET_ENUM_
{
Dog=1,
Fish,
Bird,
Horse,
Cat,
}PET_ENUM;

typedef enum _DRINK_ENUM_
{
Tea =1,
Coffee,
Water,
Milk,
Beer,
}DRINK_ENUM;

typedef enum _CIGARETTE_ENUM_
{
Pall_Mall =1,
Dunhill,
Blue_Master,
Prince,
Blends,
}CIGARETTE_ENUM;

typedef struct _PERSON_INFO_STRUCT_
{
char uclocation;
HOUSE_COLOR_ENUM enColor;
NATIONALITY_ENUM enNationality;
PET_ENUM enPet;
DRINK_ENUM enDrink;
CIGARETTE_ENUM enCigarette;
}PERSON_INFO_STRUCT;

typedef struct _RESOURCE_INFO_STRUCT_
{
char auclocation[Number+1];
HOUSE_COLOR_ENUM aenColor[Number+1];
NATIONALITY_ENUM aenNationality[Number+1];
PET_ENUM aenPet[Number+1];
DRINK_ENUM aenDrink[Number+1];
CIGARETTE_ENUM aenCigarette[Number+1];
}RESOURCE_INFO_STRUCT;


void initResource();
int condition1();
int condition2();
int condition3();
int condition4();
int condition5();
int condition6();
int condition7();
int condition8();
int condition9();
int condition10();
int condition11();
int condition12();
int condition13();
int condition14();
int condition15();
void show();
void Result();


#endif

2006-05-16 20:07
uncupid
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-5-16
收藏
得分:0 
源程序(C文件)

/************************************************************************/
/*
已知:
1、在一条街上,有5座房子,喷了5种颜色。
  2、每个房里住着不同国籍的人
  3、每个人喝不同的饮料,抽不同品牌的香烟,养不同的宠物

 问题是:谁养鱼?

  提示:
  1、英国人住红色房子
  2、瑞典人养狗
  3、丹麦人喝茶
  4、绿色房子在白色房子左面
  5、绿色房子主人喝咖啡
  6、抽Pall Mall 香烟的人养鸟
  7、黄色房子主人抽Dunhill 香烟
  8、住在中间房子的人喝牛奶
  9、 挪威人住第一间房
  10、抽Blends香烟的人住在养猫的人隔壁
  11、养马的人住抽Dunhill 香烟的人隔壁
  12、抽Blue Master的人喝啤酒
  13、德国人抽Prince香烟
  14、挪威人住蓝色房子隔壁
  15、抽Blends香烟的人有一个喝水的邻居 */
/************************************************************************/
#include "QuestionofEinsten.h"

RESOURCE_INFO_STRUCT gstResourceInfo = {0};
PERSON_INFO_STRUCT gastPerson[5]={0};

void main()
{

memset(&gstResourceInfo,0,sizeof(RESOURCE_INFO_STRUCT));
memset(&gastPerson,0,5*sizeof(RESOURCE_INFO_STRUCT));
initResource();
condition9();

getchar();
return;
}
void initResource()
{
char ucloop;
for(ucloop =1; ucloop <=5; ucloop++)
{
gstResourceInfo.aenCigarette[ucloop] = ucloop;
gstResourceInfo.aenColor[ucloop] = ucloop;
gstResourceInfo.aenDrink[ucloop] = ucloop;
gstResourceInfo.aenNationality[ucloop] = ucloop;
gstResourceInfo.aenPet[ucloop] = ucloop;
gstResourceInfo.auclocation[ucloop] = ucloop;

gastPerson[ucloop-1].uclocation = ucloop;
}
return;
}

/*9、 挪威人住第一间房*/
int condition9()
{
gastPerson[0].enNationality = Norwegian;

condition1();
return 0;
}


/*英国人住红色房子*/
int condition1()
{
int iReturnValue;
char ucloop;

for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enNationality
&& 0 == gastPerson[ucloop].enColor)
{
gastPerson[ucloop].enNationality = Britisher;
gastPerson[ucloop].enColor = Red;
gstResourceInfo.aenNationality[Britisher] = 0;
gstResourceInfo.aenColor[Red] = 0;
iReturnValue = condition2();
if( 0 != iReturnValue)
{
gstResourceInfo.aenNationality[Britisher] = Britisher;
gstResourceInfo.aenColor[Red] = Red;
gastPerson[ucloop].enNationality = 0;
gastPerson[ucloop].enColor = 0;
}
else
{
continue;
/*break;*/
}
}
}
if (ucloop >= Number)
{
return -1;
}

return 0;
}
/*2、瑞典人养狗*/
int condition2()
{
int iReturnValue;
char ucloop;

for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enNationality
&& 0 == gastPerson[ucloop].enPet)
{
gastPerson[ucloop].enNationality = Swede;
gastPerson[ucloop].enPet = Dog;
gstResourceInfo.aenNationality[Swede] = 0;
gstResourceInfo.aenPet[Dog] = 0;
iReturnValue = condition3();
if( 0 != iReturnValue)
{
gstResourceInfo.aenNationality[Swede] = Swede;
gstResourceInfo.aenPet[Dog] = Dog;
gastPerson[ucloop].enNationality = 0;
gastPerson[ucloop].enPet = 0;
}
else
{
continue;
}
}
}
if (ucloop >= Number)
{
return -1;
}
return 0;
}
/*3、丹麦人喝茶*/
int condition3()
{
int iReturnValue;
char ucloop;

if (gstResourceInfo.aenNationality[Dane] != Dane
||gstResourceInfo.aenDrink[Tea] != Tea)
{
return -1;
}

for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enNationality
&& 0 == gastPerson[ucloop].enDrink)
{
gastPerson[ucloop].enNationality = Dane;
gastPerson[ucloop].enDrink = Tea;
gstResourceInfo.aenNationality[Dane] = 0;
gstResourceInfo.aenDrink[Tea] = 0;
iReturnValue = condition5();
if( 0 != iReturnValue)
{
gstResourceInfo.aenNationality[Dane] = Dane;
gstResourceInfo.aenDrink[Tea] = Tea;
gastPerson[ucloop].enNationality = 0;
gastPerson[ucloop].enDrink = 0;
}
else
{
continue;
}
}
}
if (ucloop >= Number)
{
return -1;
}
return 0;
}

/*5、绿色房子主人喝咖啡*/
int condition5()
{
int iReturnValue;
char ucloop;

if (gstResourceInfo.aenColor[Green] != Green
||gstResourceInfo.aenDrink[Coffee] != Coffee)
{
return -1;
}
for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enDrink
&& 0 == gastPerson[ucloop].enColor)
{
gastPerson[ucloop].enColor = Green;
gastPerson[ucloop].enDrink = Coffee;
gstResourceInfo.aenColor[Green] = 0;
gstResourceInfo.aenDrink[Coffee] = 0;
iReturnValue = condition6();
if( 0 != iReturnValue)
{
gstResourceInfo.aenColor[Green] = Green;
gstResourceInfo.aenDrink[Coffee] = Coffee;
gastPerson[ucloop].enColor = 0;
gastPerson[ucloop].enDrink = 0;
}
else
{
continue;
}

}
}
if (ucloop >= Number)
{
return -1;
}
return 0;
}

/*6、抽Pall Mall 香烟的人养鸟*/
int condition6()
{
int iReturnValue;
char ucloop;


if (gstResourceInfo.aenCigarette[Pall_Mall] != Pall_Mall
||gstResourceInfo.aenPet[Bird] != Bird)
{
return -1;
}

for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enPet
&& 0 == gastPerson[ucloop].enCigarette)
{
gastPerson[ucloop].enCigarette = Pall_Mall;
gastPerson[ucloop].enPet = Bird;
gstResourceInfo.aenCigarette[Pall_Mall] = 0;
gstResourceInfo.aenPet[Bird] = 0;
iReturnValue = condition7();
if( 0 != iReturnValue)
{
gstResourceInfo.aenCigarette[Pall_Mall] = Pall_Mall;
gstResourceInfo.aenPet[Bird] = Bird;
gastPerson[ucloop].enCigarette = 0;
gastPerson[ucloop].enPet = 0;
}
else
continue;
}
}
if (ucloop >= Number)
{
return -1;
}
return 0;
}


/*7、黄色房子主人抽Dunhill 香烟*/
int condition7()
{
int iReturnValue;
char ucloop;


if (gstResourceInfo.aenCigarette[Dunhill] != Dunhill
||gstResourceInfo.aenColor[Yellow] != Yellow)
{
return -1;
}
for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enColor
&& 0 == gastPerson[ucloop].enCigarette)
{
gastPerson[ucloop].enCigarette = Dunhill;
gastPerson[ucloop].enColor = Yellow;
gstResourceInfo.aenCigarette[Dunhill] = 0;
gstResourceInfo.aenColor[Yellow] = 0;
iReturnValue = condition8();
if( 0 != iReturnValue)
{
gstResourceInfo.aenCigarette[Dunhill] = Dunhill;
gstResourceInfo.aenColor[Yellow] = Yellow;
gastPerson[ucloop].enCigarette = 0;
gastPerson[ucloop].enColor = 0;
}
else
continue;
}
}
if (ucloop >= Number)
{
return -1;
}
return 0;
}


/*8、住在中间房子的人喝牛奶*/
int condition8()
{
int iReturnValue;

if ( gastPerson[2].enDrink != 0
&&gastPerson[2].enDrink != Milk)
{
return -1;
}
if (gastPerson[2].enDrink == Milk)
{
iReturnValue = condition12();
if ( 0 != iReturnValue)
{
return -1;
}
return 0;
}
if ( gstResourceInfo.aenDrink[Milk] != Milk
&& gastPerson[2].enDrink != Milk)
{
return -1;
}


gastPerson[2].enDrink = Milk;
gstResourceInfo.aenDrink[Milk]=0;
iReturnValue = condition12();
if ( 0 != iReturnValue)
{
return -1;
}

return 0;
}

/*12、抽Blue Master的人喝啤酒*/
int condition12()
{
int iReturnValue;
char ucloop;

if ( gstResourceInfo.aenCigarette[Blue_Master] != Blue_Master
||gstResourceInfo.aenDrink[Beer] != Beer)
{
return -1;
}

for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enDrink
&& 0 == gastPerson[ucloop].enCigarette)
{
gastPerson[ucloop].enCigarette = Blue_Master;
gastPerson[ucloop].enDrink = Beer ;
gstResourceInfo.aenCigarette[Blue_Master] = 0;
gstResourceInfo.aenDrink[Beer] = 0;
iReturnValue = condition13();
if( 0 != iReturnValue)
{
gstResourceInfo.aenCigarette[Blue_Master] = Blue_Master;
gstResourceInfo.aenDrink[Beer] = Beer;
gastPerson[ucloop].enCigarette = 0;
gastPerson[ucloop].enDrink = 0;
}
else
continue;
}
}
if (ucloop >= Number)
{
return -1;
}
return 0;
}
/*13、德国人抽Prince香烟*/
int condition13()
{
int iReturnValue;
char ucloop;

if (gstResourceInfo.aenNationality[German] != German
||gstResourceInfo.aenCigarette[Prince] != Prince)
{
return -1;
}


for(ucloop = 0; ucloop < Number; ucloop++ )
{
if (0 == gastPerson[ucloop].enNationality
&& 0 == gastPerson[ucloop].enCigarette)
{
gastPerson[ucloop].enNationality = German;
gastPerson[ucloop].enCigarette = Prince;
gstResourceInfo.aenNationality[German] = 0;
gstResourceInfo.aenCigarette[Prince] = 0;
iReturnValue = condition10();
if( 0 != iReturnValue)
{
gstResourceInfo.aenNationality[German] = German;
gstResourceInfo.aenCigarette[Prince] = Prince;
gastPerson[ucloop].enNationality = 0;
gastPerson[ucloop].enCigarette = 0;
}
else
{
continue;
}
}
}

if (ucloop >= Number)
{
return -1;
}
return 0;
}

2006-05-16 20:09
uncupid
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-5-16
收藏
得分:0 
C文件(2)
/*10、抽Blends香烟的人住在养猫的人隔壁*/
int condition10()
{
int iReturnValue;
char ucloop;

if (gstResourceInfo.aenPet[Cat] != Cat
|| gstResourceInfo.aenCigarette[Blends] != Blends)
{
return -1;
}

for( ucloop = 0; ucloop < Number-1; ucloop++)
{
if ( 0 == gastPerson[ucloop].enCigarette
&& 0 == gastPerson[ucloop+1].enPet)
{
gastPerson[ucloop].enCigarette = Blends;
gastPerson[ucloop+1].enPet = Cat;
gstResourceInfo.aenPet[Cat] = 0;
gstResourceInfo.aenCigarette[Blends] = 0;
iReturnValue = condition11();
if( 0 != iReturnValue)
{
gastPerson[ucloop].enCigarette = 0;
gastPerson[ucloop+1].enPet = 0;
gstResourceInfo.aenPet[Cat] = Cat;
gstResourceInfo.aenCigarette[Blends] = Blends;
}
else
continue;

}
if ( 0 == gastPerson[ucloop+1].enCigarette
&& 0 == gastPerson[ucloop].enPet)
{
gastPerson[ucloop+1].enCigarette = Blends;
gastPerson[ucloop].enPet = Cat;
gstResourceInfo.aenPet[Cat] = 0;
gstResourceInfo.aenCigarette[Blends] = 0;
iReturnValue = condition11();
if( 0 != iReturnValue)
{
gastPerson[ucloop+1].enCigarette = 0;
gastPerson[ucloop].enPet = 0;
gstResourceInfo.aenPet[Cat] = Cat;
gstResourceInfo.aenCigarette[Blends] = Blends;
}
else
continue;

}
}
if (ucloop >= Number-1)
{
return -1;
}

return 0;
}
/*11、养马的人住抽Dunhill 香烟的人隔壁*/
int condition11()
{
int iReturnValue;
char ucloop;
/*dunhill is used*/
if (gstResourceInfo.aenCigarette[Dunhill] == Dunhill
|| gstResourceInfo.aenPet[Horse] != Horse)
{
return -1;
}

for(ucloop = 0; ucloop < Number; ucloop++)
{
if ( Dunhill == gastPerson[ucloop].enCigarette)
{
if ( 0 == ucloop
&& 0 == gastPerson[ucloop+1].enPet)
{
gastPerson[ucloop+1].enPet = Horse;
gstResourceInfo.aenPet[Horse] = 0;
iReturnValue = condition14();
if( 0 != iReturnValue)
{
gastPerson[ucloop+1].enPet = 0;
gstResourceInfo.aenPet[Horse] = Horse;
}
else
continue;
}
else if (Number-1 == ucloop
&& 0 == gastPerson[ucloop-1].enPet)
{
gastPerson[ucloop-1].enPet = Horse;
gstResourceInfo.aenPet[Horse] = 0;
iReturnValue = condition14();
if( 0 != iReturnValue)
{
gastPerson[ucloop-1].enPet = 0;
gstResourceInfo.aenPet[Horse] = Horse;
}
else
continue;
}
else
{
if ( ucloop == 0|| ucloop == Number-1)
{
return -1;
}

if(0 == gastPerson[ucloop+1].enPet)
{
gastPerson[ucloop+1].enPet = Horse;
gstResourceInfo.aenPet[Horse] = 0;
iReturnValue = condition14();
if( 0 != iReturnValue)
{
gastPerson[ucloop+1].enPet = 0;
gstResourceInfo.aenPet[Horse] = Horse;
}
else
continue;
}
if (0 == gastPerson[ucloop-1].enPet)
{
gastPerson[ucloop-1].enPet = Horse;
gstResourceInfo.aenPet[Horse] = 0;
iReturnValue = condition14();
if( 0 != iReturnValue)
{
gastPerson[ucloop-1].enPet = 0;
gstResourceInfo.aenPet[Horse] = Horse;
}
else
continue;
}
}
}

}

if ( ucloop >= Number )
{
return -1;
}
return 0;

}
/*14、挪威人住蓝色房子隔壁*/
int condition14()
{
int iReturnValue;
char ucloop;

if (gastPerson[1].enColor != Blue
&& gastPerson[1].enColor != 0)
{
return -1;
}

gastPerson[1].enColor = Blue;
gstResourceInfo.aenColor[Blue] = 0;
iReturnValue = condition15();
return iReturnValue;

}
/*15、抽Blends香烟的人有一个喝水的邻居 */
int condition15()
{
int iReturnValue;
char ucloop;

/*blends is used*/
if (gstResourceInfo.aenCigarette[Blends] == Blends
||gstResourceInfo.aenDrink[Water] != Water)
{
return -1;
}

for(ucloop = 0; ucloop < Number; ucloop++)
{
if ( Blends == gastPerson[ucloop].enCigarette)
{
if ( 0 == ucloop
&& 0 == gastPerson[ucloop+1].enDrink)
{
gastPerson[ucloop+1].enDrink = Water;
gstResourceInfo.aenDrink[Water] = 0;
iReturnValue = condition4();
if( 0 != iReturnValue)
{
gastPerson[ucloop+1].enDrink = 0;
gstResourceInfo.aenDrink[Water] = Water;
}
else
continue;
}
else if (Number-1 == ucloop
&& 0 == gastPerson[ucloop-1].enDrink)
{
gastPerson[ucloop-1].enDrink = Water;
gstResourceInfo.aenDrink[Water] = 0;
iReturnValue = condition4();
if( 0 != iReturnValue)
{
gastPerson[ucloop-1].enDrink = 0;
gstResourceInfo.aenDrink[Water] = Water;
}
else
continue;
}
else
{
if ( ucloop == 0|| ucloop == Number-1)
{
return -1;
}

if(0 == gastPerson[ucloop+1].enDrink)
{
gastPerson[ucloop+1].enDrink = Water;
gstResourceInfo.aenDrink[Water] = 0;
iReturnValue = condition4();
if( 0 != iReturnValue)
{
gastPerson[ucloop+1].enDrink = 0;
gstResourceInfo.aenDrink[Water] = Water;
}
else
continue;
}
if (0 == gastPerson[ucloop-1].enDrink)
{
gastPerson[ucloop-1].enDrink = Water;
gstResourceInfo.aenDrink[Water] = 0;
iReturnValue = condition4();
if( 0 != iReturnValue)
{
gastPerson[ucloop-1].enDrink = 0;
gstResourceInfo.aenDrink[Water] = Water;
}
else
continue;
}
}
}
}
if ( ucloop >= Number )
{

return -1;
}

return 0;
}


/*4、绿色房子在白色房子左面*/
int condition4()
{
int iReturnValue;
char ucloop;
char wlocation1,glocation2;
for(ucloop = 0; ucloop< Number; ucloop++)
{
if (0 == gastPerson[ucloop].enColor)
{
wlocation1 = ucloop;
gastPerson[ucloop].enColor = White ;
}
if (Green == gastPerson[ucloop].enColor)
{
glocation2 = ucloop;
}
}

if (glocation2 < wlocation1)
{
show();
Result();
show();
return 0;
}
else
{
gastPerson[wlocation1].enColor = 0;
return -1;
}
}

void Result()
{
char ucloop1,ucloop2;
for(ucloop1 = 0; ucloop1 < Number ; ucloop1++)
{
if (gastPerson[ucloop1].enCigarette== 0)
{
for(ucloop2 = 1; ucloop2 <= Number ; ucloop2++)
{
if (gstResourceInfo.aenCigarette[ucloop2] == ucloop2)
{
gstResourceInfo.aenCigarette[ucloop2] = 0;
gastPerson[ucloop1].enCigarette = ucloop2;
break;
}
}
}
if (gastPerson[ucloop1].enColor== 0)
{
for(ucloop2 = 1; ucloop2 <= Number ; ucloop2++)
{
if (gstResourceInfo.aenColor[ucloop2] == ucloop2)
{
gstResourceInfo.aenColor[ucloop2] = 0;
gastPerson[ucloop1].enColor = ucloop2;
break;
}
}
}
if (gastPerson[ucloop1].enDrink== 0)
{
for(ucloop2 = 1; ucloop2 <= Number ; ucloop2++)
{
if (gstResourceInfo.aenColor[ucloop2] == ucloop2)
{
gstResourceInfo.aenColor[ucloop2] = 0;
gastPerson[ucloop1].enColor = ucloop2;
break;
}
}
}
if (gastPerson[ucloop1].enPet== 0)
{
for(ucloop2 = 1; ucloop2 <= Number ; ucloop2++)
{
if (gstResourceInfo.aenPet[ucloop2] == ucloop2)
{
gstResourceInfo.aenPet[ucloop2] = 0;
gastPerson[ucloop1].enPet = ucloop2;
break;
}
}
}
if (gastPerson[ucloop1].enNationality== 0)
{
for(ucloop2 = 1; ucloop2 <= Number ; ucloop2++)
{
if (gstResourceInfo.aenNationality[ucloop2] == ucloop2)
{
gstResourceInfo.aenNationality[ucloop2] = 0;
gastPerson[ucloop1].enNationality = ucloop2;
break;
}
}
}
}
return;
}

void show()
{
char ucloop;
char aucNality[][25]=
{
"Butt ",
"Britisher",
"Swede ",
"Dane ",
"German ",
"Norwegian"
};

char aucColor[][25]=
{
"Butt ",
"Red ",
"White ",
"Blue ",
"Green ",
"Yellow"
};

char aucPet[][25]=
{
"Butt ",
"Dog ",
"Fish ",
"Bird ",
"Horse",
"Cat "
};

char aucDrink[][25]=
{
"Butt ",
"Tea ",
"Coffee",
"Water ",
"Milk ",
"Beer "
};

char aucCigarette[][25]=
{
"Butt ",
"Pall_Mall ",
"Dunhill ",
"Blue_Master",
"Prince ",
"Blends "
};

printf("\nLocation Nationality Cigarette Color Drink Pet \n");
for( ucloop = 0; ucloop < Number; ucloop++)
{
printf(" %d",ucloop);
printf(" %s",aucNality[gastPerson[ucloop].enNationality]);
printf(" %s",aucCigarette[gastPerson[ucloop].enCigarette]);
printf(" %s",aucColor[gastPerson[ucloop].enColor]);
printf(" %s",aucDrink[gastPerson[ucloop].enDrink]);
printf(" %s",aucPet[gastPerson[ucloop].enPet]);
printf("\n");
}
return;
}

2006-05-16 20:10
独角龙
Rank: 1
等 级:新手上路
帖 子:221
专家分:0
注 册:2006-5-5
收藏
得分:0 

奋斗改变一切!!
2006-05-16 21:16
SunShining
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:31
帖 子:2215
专家分:0
注 册:2006-2-17
收藏
得分:0 
这个需要仔细研究下...蛮有意思的!~

[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
2006-05-16 21:17
shen2006
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2006-4-20
收藏
得分:0 

程序是不会写
但是解是解出来了

2006-05-16 21:39
快速回复:爱因斯坦的问题,各位进来做一下
数据加载中...
 
   



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

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