这有什么问题?不能输入

img


#define _CRT_SECURE_NO_DEPRECATE
#include <string.h>
#include <stdio.h>
struct Student
{
char no[9];
char name[21];
float score;
};
struct Student stu;
int main()
{
struct Student createStu(char *no, char *name, float score);
int initStu(struct Student, char *no, char *name, float score);
void printStu(struct Student);
}
struct Student createStu(char *no, char *name, float score)
{
printf("请输入学号:");
scanf("%d",no);
printf("请输入姓名:");
scanf("%s",name);
printf("请输入成绩:");
scanf("%c",&score);
return stu;
}
int initStu(struct Student stu, char *no, char *name, float score)
{
int i,j,k;
if(strlen(stu.no)<=8)
i=0;
else
i=1;
if(strlen(stu.name)<3||strlen(stu.name)>20)
j=0;
else
j=1;
if(stu.score>100)
k=0;
else
k=1;
if(i==0||j==0||k==0)
printf("0");
else
printf("1");
return 0;
}
void printStu(struct Student stu)
{
printf("学号:%d\n姓名:%s\n成绩:%c",stu.no,stu.name,stu.score);
}

img


#define _CRT_SECURE_NO_DEPRECATE
#include <string.h>
#include <stdio.h>

struct Student
{
    char no[9];
    char name[21];
    float score;
};


Student createStu()
{
    Student stu;
    printf("请输入学号:");
    scanf("%s", stu.no);
    printf("请输入姓名:");
    scanf("%s", stu.name);
    printf("请输入成绩:");
    scanf("%f", &stu.score);
    return stu;
}

int initStu(Student stu)
{
    int i, j, k;
    if (strlen(stu.no) <= 8)
        i = 0;
    else
        i = 1;
    if (strlen(stu.name) < 3 || strlen(stu.name) > 20)
        j = 0;
    else
        j = 1;
    if (stu.score > 100)
        k = 0;
    else
        k = 1;
    if (i == 0 || j == 0 || k == 0)
        printf("0\n");
    else
        printf("1\n");
    return 0;
}

void printStu(struct Student stu)
{
    printf("学号:%d\n姓名:%s\n成绩:%f", stu.no, stu.name, stu.score);
}

int main()
{
    Student tmpStu = createStu();
    initStu(tmpStu);
    printStu(tmpStu);
}

不知道你要做什么,只是猜着你的思路改了一下。