| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 341 人关注过本帖
标题:这个程序在编译时,为何会出现错误?
只看楼主 加入收藏
丝袜脚掌
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-8-18
结帖率:0
收藏
 问题点数:0 回复次数:1 
这个程序在编译时,为何会出现错误?
程序代码如下:  #include<stdio.h>

typedef struct{
           char name[20];
           char sex;  //性别,'F'表示女性,'M'表示男性
       }Person;
       typedef Person DataType;
       //将队列中元素的数据类型改为Person
       typedef struct{
           char count;
           char p;
       }Fdancers;
       typedef struct{
           char count;
           char p;
       }Mdancers;
        CirQueue(Q)
        {
        }
        InitQueue(Q)
        {
        }
        DeQueue(Q)
        {
        }

        QueueEmpty(Q)
        {
        }
        EnQueue(Q)
        {
        }
QueueFront(Q)
{
}

       void DancePartner(Person dancer[],int num)
       {//结构数组dancer中存放跳舞的男女,num是跳舞的人数。
            int i;
            Person p;
            char Mdancers,Fdancers;
        
            CirQueue(Mdancers);
            CirQueue(Fdancers);
            InitQueue(&Mdancers);//男士队列初始化
            InitQueue(&Fdancers);//女士队列初始化
            for(i=0;i<num;i++){//依次将跳舞者依其性别入队
                 p=dancer[i];      
                 if(p.sex=='F')
                     EnQueue(&Fdancers.p);   //排入女队
                 else
                     EnQueue(&Mdancers.p);   //排入男队
             }
             printf("The dancing partners are: \n \n");
             while(!QueueEmpty(&Fdancers)&&!QueueEmpty(&Mdancers)){
                   //依次输入男女舞伴名
                   DeQueue(&Fdancers);    //女士出队
                   printf("%s        ",p.name);//打印出队女士名
                   DeQueue(&Mdancers);     //男士出队
                   printf("%s\n",p.name);    //打印出队男士名
             }
             if(!QueueEmpty(&Fdancers)){ //输出女士剩余人数及队头女士的名字
                   printf("\n There are %d women waitin for the next  round.\n",Fdancers.count);
                   QueueFront(&Fdancers);  //取队头
                   printf("%s will be the first to get a partner. \n",p.name);
              }else
                  if(!QueueEmpty(&Mdancers)){//输出男队剩余人数及队头者名字
                         printf("\n There are%d men waiting for the next   round.\n",Mdancers.count);
                         QueueFront(&Mdancers);
                         printf("%s will be the first to get a partner.\n",p.name);
                   }
        }//DancerPartners
       main()
       {
  void DancePartner(Person dancer[],int num);
       }
编译框出现了这样的语句:error C2224: left of '.p' must have struct/union type
error C2224: left of '.p' must have struct/union type
error C2224: left of '.count' must have struct/union type
error C2224: left of '.count' must have struct/union type
这怎么办呢?

搜索更多相关主题的帖子: 编译 
2010-08-29 16:56
cosdos
Rank: 9Rank: 9Rank: 9
来 自:ShangHai
等 级:蜘蛛侠
威 望:6
帖 子:2109
专家分:1385
注 册:2007-6-19
收藏
得分:0 
char Mdancers,Fdancers;
EnQueue(&Fdancers.p);
EnQueue(&Mdancers.p);

Fdancers 和 Mdancers 是 char 类型。 不是结构。

—>〉Sun〈<—
2010-08-29 17:07
快速回复:这个程序在编译时,为何会出现错误?
数据加载中...
 
   



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

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