Kobe丶Bryant 2019-06-21 09:57 采纳率: 66.7%
浏览 447

Microsoft Visual Studio 2010 求个大神解决一下问题 帮帮忙啊!!菜鸟在线等

源文件
void menu()
{
int quanxianflag = 0;
char name1[10];
char password1[15];
show();
initial_stuff();
initial_goods();
printf("请输入用户名:\n");
scanf("%s",name1);
printf("请输入用户密码:\n");
scanf("%s",password1);
stuffnode *p2;
p2 = stuffhead;
while(p2->next != NULL)
{
if ((strcmp( p2->s.name, name1) == 0 && strcmp( p2->s.password, password1) == 0 ) &&
((strcmp( p2->s.quanxian, "y") == 0 || strcmp( p2->s.quanxian, "Y") == 0 )))
{
quanxianflag = 1;
break;
}
else
{
p2 = p2->next;
}
}
结构体
struct stuff //员工数据结构体
{
char name[10];
char password[10];
char quanxian[2];
};
struct goods //货品数据结构体
{
char number[20];
char name[20];
int quantity;
char cost[20];
char volume[20];
char weight[20];
};
typedef struct a
{
struct stuff s;
struct a *next;
}stuffnode;
typedef struct b
{
struct goods g;
struct b *next;
}goodsnode;
stuffnode *stuffhead = NULL; //全局结构体链表指针变量头指针
stuffnode *stuffp1 = NULL;
goodsnode *goodshead = NULL;
goodsnode *goodsp1 = NULL;
显示错误
错误 23 error C2065: “p2”: 未声明的标识符

警告 25 warning C4047: “=”:“int”与“stuffnode *”的间接级别不同

错误 22 error C2275: “stuffnode”: 将此类型用作表达式非法
错误 27 error C2223: “->next”的左侧必须指向结构/联合
错误 33 error C2198: “strcmp”: 用于调用的参数太少

错误 29 error C2223: “->s”的左侧必须指向结构/联合

  • 写回答

1条回答

  • threenewbee 2019-06-21 11:43
    关注
    #include <stdio.h>
    #include <string.h>
    
    struct stuff //???????
    {
    char name[10];
    char password[10];
    char quanxian[2];
    };
    struct goods //???????
    {
    char number[20];
    char name[20];
    int quantity;
    char cost[20];
    char volume[20];
    char weight[20];
    };
    typedef struct a
    {
    struct stuff s;
    struct a *next;
    }stuffnode;
    typedef struct b
    {
    struct goods g;
    struct b *next;
    }goodsnode;
    
    
    stuffnode *stuffhead = NULL; //??????????????
    stuffnode *stuffp1 = NULL;
    goodsnode *goodshead = NULL;
    goodsnode *goodsp1 = NULL;
    
    void show()
    {
    
    }
    void initial_stuff()
    {
    
    }
    
    void initial_goods()
    {
    
    }
    
    void menu()
    {
        int quanxianflag = 0;
        char name1[10];
        char password1[15];
        show();
        initial_stuff();
        initial_goods();
        printf("??????:\n");
        scanf("%s",name1);
        printf("???????:\n");
        scanf("%s",password1);
        stuffnode *p2;
        p2 = stuffhead; 
        while(p2->next != NULL)
        {
            if ((strcmp( p2->s.name, name1) == 0 && strcmp( p2->s.password, password1) == 0 ) && 
            ((strcmp( p2->s.quanxian, "y") == 0 || strcmp( p2->s.quanxian, "Y") == 0 )))
            {
            quanxianflag = 1;
            break;
            }
            else
            {
            p2 = p2->next;
            }
        }
    }
    
    
    int main(int argc, char* argv[])
    {
        return 0;
    }
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?