- #1
nard
- 16
- 0
the foolowing program is to read inputed data and display them all at once but when i run it it asks for the first information and then runs the total program without asking for the input of other information.after that it doesn't respond and closes immediatelly.
can someone help me and tells me what's wrong with my program?
thanks for your help.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct database {
char name;
int phone_number,id_numb;
};
main()
{
struct database ident;
printf("enter a name\n");
scanf("%c",&ident.name);
printf("enter a phn numb\n");/* enter a phone number*/
scanf("%d",&ident.phone_number);
printf("enter the id_numb\n");/*enter an id number*/
scanf("%d",&ident.id_numb);
printf("the identity of %s is:\n",ident.name);/*displays the name*/
printf("phone:%d id:%d \n",ident.phone_number,ident.id_numb);/*displays the phone number and the id number*/
system("PAUSE");
}
can someone help me and tells me what's wrong with my program?
thanks for your help.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct database {
char name;
int phone_number,id_numb;
};
main()
{
struct database ident;
printf("enter a name\n");
scanf("%c",&ident.name);
printf("enter a phn numb\n");/* enter a phone number*/
scanf("%d",&ident.phone_number);
printf("enter the id_numb\n");/*enter an id number*/
scanf("%d",&ident.id_numb);
printf("the identity of %s is:\n",ident.name);/*displays the name*/
printf("phone:%d id:%d \n",ident.phone_number,ident.id_numb);/*displays the phone number and the id number*/
system("PAUSE");
}