Em có đoạn mã nhập dữ liệu sinh viên bên dưới.Nếu dùng codeblock, thay scanf_s bằng scanf thì chạy ngon lành, nhưng trong visual studio 2017 nó không cho em nhập tên sinh viên, mà chuyển luôn xuống nhập lớp. Mong mọi người giải thích giúp em với ạ.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
typedef struct
{
char name[30];
char classroom[10];
float mMath; // diem toan
float mPhysical; // diem ly
float mChemistry;// diem hoa
}*PSTUDENT, STUDENT;
void ImportInfo(PSTUDENT pStudent, int total);
void main()
{
PSTUDENT pStudent;
int totalStudent;
char c;
printf("\nBan can quan ly bao nhieu sinh vien: ");
scanf_s("%d", &totalStudent);
// cap phat vung nho de luu thong tin cac sinh vien
pStudent = (PSTUDENT)malloc(totalStudent * sizeof(STUDENT));
if (pStudent == NULL)
{
printf("\nLoi cap phat bo nho");
return;
}
memset(pStudent, NULL, totalStudent * sizeof(STUDENT));
// Nhap thong tin sinh vien
ImportInfo(pStudent, totalStudent);
}
void ImportInfo(PSTUDENT pStudent, int total)
{
int i;
printf("\n==================Nhap thong tin sinh vien====================\n");
for (i = 0; i < total; i++)
{
printf("\nSinh vien [%d]\n", i + 1);
printf("\nTen sinh vien : ");
fflush(stdin);
gets(pStudent[i].name);
printf("\nLop hoc: ");
fflush(stdin);
gets(pStudent[i].classroom);
printf("\nDiem toan: ");
scanf_s("%f", &pStudent[i].mMath);
printf("\nDiem ly: ");
scanf_s("%f", &pStudent[i].mPhysical);
printf("\nDiem hoa: ");
scanf_s("%f", &pStudent[i].mChemistry);
printf("\n========================================================");
}
}

giờ dùng
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?