title: Menu type program
body: <p>I have an assignment to write a program for supporting an art gallery in C. It has to be menu based program using lists. I wrote the first function of the menu and I need some help writing the other three. So I have a structure of an unique code of the painting, author's name, painting's name, price, year of the painting. I have to create a function deleting a painting using the unique code, print out all the info about every painting and modifying a painting again using said code. The data has to be in a dynamic type structure using a linked list. This is the program so far. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void addPainting(void);
  void erasePainting(void);
  void printData(void);
  void modifyData(void);
  
  int main()
  {
  
      struct paintings
      {
          char code[20];
          char name[50];
          char paintingName[50];
          double price;
          int year;
  
      }painting[100];
      int choice;
      do
      {
          printf("Menu\n");
          printf("To add a painting press 1.\n");
          printf("To erase a painting press 2.\n");
          printf("To print data for all paintings by authors alphabetically press 3.\n");
          printf ("To modify data for a painting press 4.\n");
          printf("To exit the program press 5.\n");
          scanf("%d",&amp;choice);
  
          switch(choice)
          {
             case 1:
              {
                  addPainting();
                  break;
              }
              case 2:
              {
                  erasePainting();
                  break;
              }
              case 3:
              {
                  printData();
                  break;
              }
              case 4:
              {
                  modifyData();
                  break;
              }
  
              default: printf ("Wrong choice. Try again\n");
                  break;
          }
      }while (choice !=5);
  
  
  
  void addPainting()
  {
      FILE *fp;
  
  
      struct paintings painting;
      printf("Enter code:");
      scanf("%s", &amp;painting.code);
      printf("Enter the name of the author:");
      scanf("%s", &amp;painting.name);
      printf("Enter the name of the painting:");
      scanf("%s", &amp;painting.paintingName);
      printf("Enter price:");
      scanf("%lf", &amp;painting.price);
      printf("Enter the year of creation:");
      scanf("%d", &amp;painting.year);
        if ((fp=fopen("paintings","wb"))==NULL)
          exit(1);
      if ((fwrite (&amp;painting,sizeof(painting),1,fp)!=1))
          exit(2);
      fclose(fp);
  
  }
  
  
  
  }
  </code></pre>