Advertisement
akanoce

Ex.1_22_5_17

Jan 6th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. //CODE.h
  2.  
  3. #include<iostream>
  4.  
  5. struct nodo {
  6.     char chiave;
  7.     nodo *next;
  8.    
  9.     nodo(char c='\0', nodo* n=NULL);
  10. };
  11.  
  12. struct coda {
  13.     nodo *inizio;
  14.     nodo *fine;
  15.    
  16.     coda(nodo * t= NULL, nodo* f = NULL);
  17. };
  18.  
  19. void push(char c, coda &Q);
  20. char pop(coda &Q);
  21. bool e_vuota(coda Q);
  22.  
  23. //main.cpp
  24.  
  25. #include <iostream>
  26. #include "code.h"
  27.  
  28. using namespace std;
  29.  
  30. int main()
  31. {
  32.     coda  Q = new coda();
  33.    
  34.     cout << "start" << endl;
  35.    
  36.     char c;
  37.     bool check = true;
  38.    
  39.  
  40.     while (check){
  41.        
  42.         cin>>c;
  43.        
  44.         switch(c){
  45.            
  46.             case '*':
  47.             cout<<pop(Q)<<" ";
  48.             break;
  49.            
  50.             case'.':
  51.             check = false;
  52.             break;
  53.            
  54.             default:
  55.             push(c,Q);
  56.             break;
  57.            
  58.            
  59.            
  60.            
  61.            
  62.            
  63.         }//swtich
  64.        
  65.        
  66.        
  67.     }//check */
  68.  
  69.     cout << "end" << endl;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement