#include<stdio.h> #include<string.h> int main() { int entry,i,option; printf("\nPlease indicate the number of records you want to enter :\n"); scanf("%d",&entry); char ent[entry][100],name[entry][20],surname[entry][20],score[entry][10]; printf("\nPlease input records of students (enter a new line after each record), with following format first name last name score \n"); for(i=0;i<entry-1;i++) { printf("%d",i); gets(ent[i]); printf("%s",ent[i]); } for(i=0;i<entry-1;i++) { strncpy(name[i],strtok(ent[i]," "),sizeof(name[i])); printf("\n%s\n",name[i]); } printf("\nPlease choose the appropriate options :"); printf("\nPrint records (press 1)\nSearch by first name (press 2)\nSearch by last name (press 3)\nSort by score (press 4)\nSort by last name (press 5)\nExit the program (press 0)\n"); scanf("%d",&option); return 0; }
gets
scanf
Quote: printf("%d",i); gets(ent[i]); printf("%s",ent[i]);
printf("%d\n",i); gets(ent[i]); printf("[%s]\n",ent[i]);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)