1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#include <conio.h>
#include <string.h>
#include <stdio.h>
main(){
clrscr();
char *token, *token1, *token2;
char *usTring;
printf("Enter a String: ");
scanf("%s",usTring);
token = strtok(usTring,"\n,");
token1 = strtok(NULL,",");
token2 = strtok(NULL,",");
while (token != NULL){
printf ("Emp Name: %s\n"
"Emp ID: %s\n"
"Emp sal Level: %s",
token,token1,token2);
token = strtok(NULL,",");
token1 = strtok(NULL,",");
token2 = strtok(NULL,",");
}
getch();
return 0;
}
|