So i try to read first and last name (at elev[i].nume) and it doesnt work i looked on other questions still doesnt work
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
struct caract
{
char nume[30];
float medie ;
float note[4];
int prom;
};
scanf("%d", &n);
struct caract elev[n];
for(int i=0;i<n;i++)
{
scanf("%[^\n]%s", &elev[i].nume);
elev[i].medie=0.0;
elev[i].prom=1;
for(int j=0;j<4;j++)
....
if(elev[i].prom==1)
{
printf("%s ", elev[i].nume);
printf("%.2f \n", elev[i].medie);
}
}
return 0;
}
I expected to read whole string but only read first word. I know there is a getline in c++ for this