Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. typedef struct notatki{
  2. char nazwa[100];
  3. char tresc[1000];
  4. int priorytet ; // 1 - wysoki, 2 - normalny, 3 -wysoki
  5. int waznosc; // 1/0
  6. struct notatki *nastepna_notatka
  7. }NOTATKI;
  8.  
  9. NOTATKI *pierwsza_notatka=NULL;
  10.  
  11. void dodaj_notatke(){
  12. struct notatki *nowa;
  13. nowa=(struct notatki*)malloc(sizeof(nowa));
  14. int ilosc_notatek=0;
  15. system("cls");
  16. char nazwa_pom[100];
  17. char tresc_pom[1000];
  18. int priorytet_pom;
  19. printf("Podaj nazwe notatki: (Max. 100 znakow)\n");
  20. gets(nazwa_pom);
  21. strcpy(nowa->nazwa,nazwa_pom);
  22. printf("Podaj tresc notatki: (Max. 1000 znakow)\n");
  23. gets(tresc_pom);
  24. strcpy(nowa->tresc,tresc_pom);
  25. printf("Podaj priorytet notatki: (1[wysoki]-3[niski])\n");
  26. scanf("%d",&priorytet_pom);
  27.  
  28. nowa->priorytet=priorytet_pom;
  29. nowa->nastepna_notatka=NULL;
  30. nowa->waznosc=1;
  31.  
  32. if(pierwsza_notatka==NULL){
  33. pierwsza_notatka=nowa;
  34. }
  35.  
  36. else{
  37. struct notatki *wsk=pierwsza_notatka;
  38. while(wsk->nastepna_notatka != NULL){
  39. wsk=wsk->nastepna_notatka;
  40. }
  41. wsk->nastepna_notatka=nowa;
  42. free(nowa);
  43. ilosc_notatek++;
  44. }
  45.  
  46. menu();
  47.  
  48. }
  49.  
  50. void wypisz(){
  51. printf("\n");
  52. NOTATKI *wsk=pierwsza_notatka;
  53. while(wsk != NULL){
  54. printf("%s\n",wsk->nazwa);
  55. wsk=wsk->nastepna_notatka;
  56. }
  57. }
  58.  
  59. int main(){
  60. pierwsza_notatka=malloc(sizeof(NOTATKI));
  61. menu();
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement