| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 892 人关注过本帖
标题:求大神指导指导
只看楼主 加入收藏
a83342358
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-4-9
结帖率:66.67%
收藏
已结贴  问题点数:10 回复次数:1 
求大神指导指导
这是代码
#include <stdio.h>
#include <malloc.h>
struct student
{
    char num[13];char name[10];
    char sex[10];
    struct student *next;
};

int Input(struct student stu[];int n)
{
    int i;
    student *p,*r;
    r=head;
    for(i=0;i<n;i++)
    {
        s=(struct student*)malloc(sizeof(struct student));
        printf("请输入第%d个学生的学号:\n",n+1);
        scanf("%s",&s->num);
        printf("请输入第%d个学生的姓名:\n",n+1);
        scanf("%s",&s->name);
        printf("请输入第%d个学生的性别:\n",n+1);
        scanf("%s",&s->sex);
        r->next=s;
        r=s;
    }
    r->next=NULL;
    return 0;
}

int main()
{
    struct student stu[3];
    Input(stu,3);
    return 0;
}

这是错误
c:\users\stonezzzs\desktop\vc\员工管理(操作)\员工管理(操作).cpp(10) : error C2143: syntax error : missing ')' before ';'
c:\users\stonezzzs\desktop\vc\员工管理(操作)\员工管理(操作).cpp(10) : error C2059: syntax error : ')'
c:\users\stonezzzs\desktop\vc\员工管理(操作)\员工管理(操作).cpp(11) : error C2239: unexpected token '{' following declaration of 'n'
c:\users\stonezzzs\desktop\vc\员工管理(操作)\员工管理(操作).cpp(34) : error C2660: 'Input' : function does not take 2 parameters

不明白这些错误在哪里,求指导啊

搜索更多相关主题的帖子: struct student 员工 管理 操作 
2018-04-09 23:28
吹水佬
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:451
帖 子:10539
专家分:42927
注 册:2014-5-20
收藏
得分:10 
编译问题:
//int Input(struct student stu[]; int n)
int Input(struct student stu[], int n)
{
    int i;
    //student *p,*r;
    struct student *p,*r;
    struct student *head=NULL,*s; //增加一句,不知运算对否
2018-04-10 05:52
快速回复:求大神指导指导
数据加载中...
 
   



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

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