01/10/2018, 09:41
Bài tập về nhập xuất chuỗi. mọi người sửa lỗi sai giúp m
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
char name[30];
scanf("%d",&n);
for(int i=0;i<n;i++)
{
printf("Enter name: ");
gets(name);
printf("Name: ");
puts(name);
}
return 0;
}

Bài liên quan
sửa dòng 7
scanf(%d%*c,&n)
để nó “nuốt” ký tự xuống dònghoặc thêm vào câu lệnh
fflush(stdin);
ngay bên dưới scanfcảm ơn anh rất nhiều em đã làm được bài