Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct towar
  5. {
  6. char nazwa [50];
  7. double ilosc,cena;
  8. int numer;
  9. };
  10.  
  11. void sprzedaz(void);
  12. void dostawa(void);
  13. void drukuj_p(char *nazwa);
  14. void drukuj(struct towar t);
  15.  
  16.  
  17.  
  18.  
  19.  
  20. main()
  21. {
  22. char z;
  23.  
  24. do{
  25. fflush(stdin);
  26. printf("MENU: \nd-dostawa \n s-sprzedaz\n m-wydruk magazynu \nf- faktura \nq- wyjscie\n");
  27. scanf("%c",&z);
  28.  
  29. switch(z)
  30. {
  31. case 'd':
  32. {
  33. dostawa();
  34. break;
  35. }
  36. case 's':
  37. {
  38. sprzedaz();
  39. break;
  40.  
  41. }
  42. case 'm':
  43. {
  44. drukuj_p("magazyn.txt");
  45. break;
  46. }
  47. case 'f':
  48. {
  49. drukuj_p("faktura.txt");
  50. }
  51. default:
  52. {
  53. break;
  54. }
  55. }
  56.  
  57. }while (z!='q'&&z!='q')
  58. }
  59.  
  60. void sprzedaz(void)
  61. {
  62. }
  63.  
  64. void dostawa(void)
  65. {
  66. FILE *p=fopen("magazyn.txt","a");
  67. struct towar s;
  68. printf("Podaj nazwe: ");
  69. scanf("%s",s.nazwa);
  70. printf("Podaj ilosc: ");
  71. scanf("%s",s.ilosc);
  72. printf("Podaj cene: ");
  73. scanf("%s",s.cena);
  74. printf("Podaj numer: ");
  75. scanf("%s",s.numer);
  76. fwrite(&s,sizeof(s),1,p);
  77. fclose(p);
  78.  
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement