+ 2

string input in c

i think it should asked my name and feedback sequentially put it didn't why, please copy code and run on codeblock, sololearn can't do this code: #include<stdio.h> #include<string.h> void main(){ char name[20]; char feedback[1000]; int yy,dd,mm; printf("enter date im A.D and all in number"); printf("enter today year"); scanf("%d",&yy); printf("enter todays month"); scanf("%d",&mm); printf("enter toady day\n"); scanf("%d",&dd); printf("Entet your name:\n"); fgets(name,20,stdin); printf("enter your feedback in short\n\n"); gets(feedback); printf("\n\ndate:%d/%d/%d\n\n",yy,mm,dd); printf("%s\n\n",name); printf("%s",feedback); }

11th Feb 2019, 10:12 AM
anjit pariyar
anjit pariyar - avatar
3 Réponses
+ 3
It does work on Sololearn. You just need to get used to how inputs are handled here. Try with this input: 2018 12 25 Santa Too much work! https://code.sololearn.com/cu9BQJX8SEWN/?ref=app
11th Feb 2019, 11:26 AM
Zen
Zen - avatar
+ 2
thank you for your concern , but the problem is,(in codeblock) it didn't asked for name and feedback , rather it asked both at once
11th Feb 2019, 12:43 PM
anjit pariyar
anjit pariyar - avatar
+ 2
it output name and feedback at same line .
11th Feb 2019, 12:44 PM
anjit pariyar
anjit pariyar - avatar