Advertisement
apl-mhd

Bappy sir 2

Mar 15th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. #include <cstring>
  2. #include <iostream>
  3. #include <cstdio>
  4. using namespace std;
  5.  
  6. struct list{
  7.    
  8.         int data;
  9.         struct list *next;
  10.         struct list *prev;
  11.    
  12. };
  13.  
  14. typedef struct list node;
  15.  
  16. node *Insert(node *head, int y,int x){
  17.    
  18.         node *temp;
  19.         if(head == NULL){
  20.            
  21.             head = new node();
  22.        
  23.             head->prev = NULL;
  24.            
  25.             temp = new node();
  26.             head->next = NULL;
  27.             temp->data = x;
  28.             temp->next = NULL;
  29.            
  30.             temp->prev = head;
  31.            
  32.            
  33.            
  34.         }
  35.    
  36.     }
  37.  
  38.  
  39. int main(int argc, char **argv)
  40. {
  41.            
  42.    
  43.     int flag=1;
  44.     int y, x,del;
  45.     char function[20];
  46.    
  47.     node *head;
  48.    
  49.     head = new node();
  50.    
  51.     head->prev = NULL;
  52.     head->next = NULL;
  53.    
  54.    
  55.     while(flag){
  56.        
  57.         scanf("%s",function);
  58.        
  59.         if(strcmp(function, "ins")==0){
  60.                
  61.            
  62.                 scanf("%d%d", &y,&x);
  63.                 printf("%d %d", y, x);
  64.                
  65.                
  66.             }
  67.            
  68.         if(strcmp(function, "shw")==0){
  69.            
  70.                 cin>>del;
  71.                
  72.             }
  73.            
  74.         if(strcmp(function, "del")==0){
  75.            
  76.             printf("del");
  77.            
  78.             }
  79.        
  80.         if(strcmp(function, "sch")==0){
  81.            
  82.             printf("sch");
  83.            
  84.             }
  85.            
  86.         if(strcmp(function, "shw")==0){
  87.            
  88.             printf("shw");
  89.            
  90.             }
  91.            
  92.         if(strcmp(function, "ext")==0){
  93.            
  94.             flag =0;
  95.            
  96.             }  
  97.     }
  98.    
  99.    
  100.        
  101.     return 0;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement