Advertisement
Guest User

haivistolamiatorre?

a guest
Dec 15th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. #include "stdio.h"
  2. #include "stdlib.h"
  3. #include "string.h"
  4.  
  5. /*
  6. voglio creare una lista di macchine con nome e velocità
  7. aggiungere
  8. eliminare
  9. ordinare in base alla velocità
  10.  
  11. */
  12.  
  13.  
  14. typedef struct S_RacingCar {
  15.  
  16.     char name[12];
  17.     int speed;
  18.     struct S_RacingCar *next;
  19.     struct S_RacingCar *previous;
  20.    
  21. } RacingCar;
  22.  
  23.  
  24. void stampa()
  25. {
  26.  
  27.     printf("La lista è\n");
  28. }
  29.  
  30. void addcar()
  31. {
  32.  
  33.     printf("add car\n");
  34. }
  35.  
  36.  
  37. int main(){
  38.  
  39.  
  40.  char comando[16];
  41.  char input[16];
  42.  
  43.  
  44.  while( fgets(input, 15, stdin)){
  45.  
  46.     sscanf(input, "%s", comando);
  47.  
  48.     if(strncmp(comando, "quit", 4) == 0)
  49.     {
  50.         printf("\n\n se vedemo \n");
  51.         break;
  52.     }else if( strncmp(comando, "stampa", 6) == 0){
  53.         stampa();
  54.     }else if( strncmp(comando, "aggiungi", 8) == 0){
  55.         addcar();
  56.     }
  57.  
  58.  }
  59.  
  60.  
  61. printf("diocane\n");
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement