#include "string.h"
struct search{
char *name;
int id;
float value;
};
void main(){
char *name;
int i;
struct search array[4];
array[0].name="raja";array[0].id=1;array[0].value=10.0;
array[1].name="rani";array[1].id=2;array[1].value=20.0;
array[2].name="rohit";array[2].id=3;array[2].value=30.0;
array[3].name="manish";array[3].id=4;array[3].value=560.0;
clrscr();
scanf("%s",name);
for(i=0;i<4;i++){
if(!strcmp(name,array[i].name)){
printf("name: %s id: %d value: %f",array[i].name,array[i].id,array[i].value);
break;
}
}
if(i==4)
printf("Sorry this name is not persent");
getch();
}
No comments:
Post a Comment