Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. struct movie {
  7. string title;
  8. int year;
  9. string director;
  10. int id;
  11. };
  12. struct oscar {
  13. string title;
  14. string category;
  15. int year;
  16. int id;
  17. };
  18. struct actor {
  19. string first_name;
  20. string last_name;
  21. int age;
  22. };
  23.  
  24. void wyswietl(string filename){
  25. ifstream odczyt;
  26. odczyt.open(filename.c_str());
  27. string w1, w2, w3, w4;
  28. if (odczyt.good()){
  29. while (odczyt>>w1>>w2>>w3>>w4){
  30. cout<<w4<<" "<<w1<<" "<<w2<<" "<<w3<<endl;
  31. }
  32. }
  33. }
  34.  
  35. void dodaj (string filename){
  36. ofstream zapis;
  37. zapis.open(filename.c_str(), ios::app);
  38. if(filename == "movies"){
  39. movie film;
  40. cout<<"tytul: ";
  41. cin>>film.title;
  42. cout<<"Director: ";
  43. cin>>film.director;
  44. cout<<"Rok produkcji: ";
  45. cin>>film.year;
  46. cout<<"ID: ";
  47. cin>>film.id;
  48. zapis.open("movies.txt", ios::app);
  49. zapis<<film.id<<" "<<film.title<<" "<<film.year<<" "<<film.director<<endl;
  50. }
  51. }
  52.  
  53. void movies(){
  54. cout<<endl<<"filmy: "<<endl;
  55. cout<<"1.Filmy"<<endl<<"";
  56. }
  57.  
  58. void menu (){
  59. cout<<"Baza filmów.."<<endl;
  60. cout<<"Menu: "<<endl;
  61. cout<<"wybierz.."<<"1.Filmy"<<endl<<"2.Oscary"<<endl<<"3.Aktorzy"<<endl;
  62. int wybor;
  63. cin>>wybor;
  64. switch(wybor){
  65. case 1: break;
  66. case 2: break;
  67. case 3: break;
  68. default:
  69. cout<<"Zły numer"<<endl;
  70. menu();
  71. }
  72. }
  73. int main()
  74. {
  75. movie films[3];
  76. films[0].title= "Harry Potter";
  77. films[0].year= 2002;
  78. films[1].title= "SuperMan";
  79. films[1].year= 1997;
  80. films[2].title= "Batman";
  81. films[2].year= 1990;
  82. menu();
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement