main funkcija SP


/ Published in: C++
Save to your folder(s)

Glavna funkcija iz zadatka 1 strukture podataka!


Copy this code and paste it in your HTML
  1. #include<iostream>
  2. #include "polje.h"
  3. //#include "lista.h"
  4. using namespace std;
  5. int p = 1,h,k;
  6. int main(){
  7. char naziv[100];
  8. char vrsta[100];
  9. char vne;
  10. int br;
  11. int izbor;
  12. do{
  13. cout <<"Izbornik: "<<endl;
  14. cout << "1. Dodavanje elemenata." <<endl;
  15. cout << "2. Ispis zivotinja."<<endl;
  16. cout << "3. Pretrazivanje liste."<<endl;
  17. cout << "4. Brisanje pojedinacnog elementa ili po vrsti."<<endl;
  18. cout<<"9. Izlaz iz programa."<<endl;
  19. cin >> izbor;
  20. system("cls");
  21. switch(izbor){
  22. case 1:
  23. InsertL(p, lista);
  24. break;
  25. case 2: br = NumberL(lista);
  26. for(int i=br;i>0; i--){
  27. RetreiveL(i, lista);
  28. }
  29. break;
  30. case 3: pretrazi(lista);
  31. break;
  32. case 4:
  33. cout<<"Zelite li brisati po vrsti ili nazivu? (v/n)"<<endl;
  34. cin>>vne;
  35. if(vne=='n' || vne=='N'){
  36. cout<<"Unesite naziv vrste koju zelite brisati: ";
  37. cin.ignore();
  38. cin.getline(naziv, 100);
  39. h=DeleteL(lista, naziv);
  40. if(h==1) p--;
  41. }
  42. if(vne=='v' || vne=='V'){
  43. cout<<"Unesite vrstu zivotinja koju zelite pobrisati: ";
  44. cin.ignore();
  45. cin.getline(vrsta, 100);
  46. h=DeleteL(vrsta, lista);
  47. p-=h;
  48. }
  49. break;
  50. default: cout << "Krivi unos, unesite jedan od gore navedenih brojeva"<<endl;
  51. }
  52. }while(izbor!=9);
  53. return 0;
  54. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.