Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #define N 0
- struct data{
- char name[50];
- char time[50];
- struct data *next;
- };
- typedef data node;
- node *head=N,*last=N;
- void addpatient(char na[50],char ti[50]){
- node *temp=(node *)malloc(sizeof(node));
- strcpy(temp->name,na);
- strcpy(temp->time,ti);
- if(head==N){
- head=temp;
- last=temp;
- return;
- }
- last->next=temp;
- last=temp;
- }
- void create(){
- int n;
- scanf("%d",&n);
- int p=0;
- while(p<n){
- char na[50];
- char ti[50];
- scanf("%s",&na);
- scanf("%s",&ti);
- addpatient(na,ti);
- ++p;
- }
- }
- void print(){
- node *temp= head;
- int i;
- while(1){
- printf("%s,%s",temp->name,temp->time);
- scanf("%d",&i);
- if(i==1)
- create();
- if(temp->next==N)
- break;
- else
- temp=temp->next;
- }
- }
- int main(){
- create();
- print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement