C++ 错误:无法将参数1从';char[80]';至';char';

C++ 错误:无法将参数1从';char[80]';至';char';,c++,C++,我正在尝试将int传递给结构。我必须验证它,并且类指令说我必须通过函数运行它 以下是错误消息: C2664:'int get_id(char)':无法将参数1从'char[80]'转换为'char' #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <cstdio>

我正在尝试将int传递给结构。我必须验证它,并且类指令说我必须通过函数运行它

以下是错误消息:

C2664:'int get_id(char)':无法将参数1从'char[80]'转换为'char'

 #define _CRT_SECURE_NO_WARNINGS
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #include <cstdio>
    #include <iostream>
    #include <fstream>
    #include <cstring>
    #include <exception>


//functions called
int get_id(char);

//structs
struct fileinfo
{
    int id;
    char name[20];
    char state[5];
    char dis_code;
    float balance;
    char due_date[40];
};


//why is it void?
int main(void)
{
    fileinfo info[80];

    int ct = 0;
    char more = 'y';
    char buff[80];

    while (more == 'y')
    {

        printf("ID: ");
        gets_s(buff);

        info[ct].id = get_id(buff);
        printf("this is ID: %i", info[ct].id);

        printf("Do you want to enter another? ");
        gets_s(buff);
        more = buff[0];
    }

    system("pause");

}//end main

int get_id(char buf[])
{
    int id;
    char buffer[85];
    bool check = false;

    id = atoi(buf);
    while (check == false)
    {
        if (id > 998)
        {
            printf("\n This ID number is too large, please re-enter: ");
            gets_s(buffer);
            id = atoi(buffer);
            check = false;
        }
        else
        {
            check = true;
        }
    }

    return id;
}
\define\u CRT\u SECURE\u NO\u警告
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
//调用的函数
int get_id(字符);
//结构
结构文件信息
{
int-id;
字符名[20];
半焦态[5];
字符显示码;
浮动天平;
字符到期日[40];
};
//为什么它是空的?
内部主(空)
{
fileinfo[80];
int-ct=0;
char more='y';
字符buff[80];
而(更多=='y')
{
printf(“ID:”);
获取_s(buff);
信息[ct].id=get\u id(buff);
printf(“这是ID:%i”,info[ct].ID);
printf(“是否要输入另一个?”);
获取_s(buff);
more=buff[0];
}
系统(“暂停”);
}//端干管
int get_id(char buf[])
{
int-id;
字符缓冲区[85];
布尔检查=假;
id=atoi(buf);
while(check==false)
{
如果(id>998)
{
printf(“\n此ID号太大,请重新输入:”;
获取_s(缓冲区);
id=atoi(缓冲区);
检查=错误;
}
其他的
{
检查=正确;
}
}
返回id;
}

prototype
int-get\u-id(char)
int get_id(char*)
获取\u s(buff)到<代码>得到s(buff,79)“请你们不要像上次一样在这里用负面报道来攻击我的帐户。”你们和Meta谈过了吗?因为如果真的有虐待,我相信他们会很乐意听到的。这听起来更像是一个非常普通的用户拒绝接受批评或对我的负面反馈。我从未使用过meta。在我学完这门课之后,我将不得不探索这个选项。我喜欢这个网站,看起来我遇到了很多常见的问题。我只是不够快,无法回答别人的问题。这不是C,而是C++,带有CSTDIO,FSUSTER,异常,cSnc++…哇,我怎么会错过呢。