Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- struct movie {
- string title;
- int year;
- string director;
- int id;
- };
- struct oscar {
- string title;
- string category;
- int year;
- int id;
- };
- struct actor {
- string first_name;
- string last_name;
- int age;
- };
- void wyswietl(string filename){
- ifstream odczyt;
- odczyt.open(filename.c_str());
- string w1, w2, w3, w4;
- if (odczyt.good()){
- while (odczyt>>w1>>w2>>w3>>w4){
- cout<<w4<<" "<<w1<<" "<<w2<<" "<<w3<<endl;
- }
- }
- }
- void dodaj (string filename){
- ofstream zapis;
- zapis.open(filename.c_str(), ios::app);
- if(filename == "movies"){
- movie film;
- cout<<"tytul: ";
- cin>>film.title;
- cout<<"Director: ";
- cin>>film.director;
- cout<<"Rok produkcji: ";
- cin>>film.year;
- cout<<"ID: ";
- cin>>film.id;
- zapis.open("movies.txt", ios::app);
- zapis<<film.id<<" "<<film.title<<" "<<film.year<<" "<<film.director<<endl;
- }
- }
- void movies(){
- cout<<endl<<"filmy: "<<endl;
- cout<<"1.Filmy"<<endl<<"";
- }
- void menu (){
- cout<<"Baza filmów.."<<endl;
- cout<<"Menu: "<<endl;
- cout<<"wybierz.."<<"1.Filmy"<<endl<<"2.Oscary"<<endl<<"3.Aktorzy"<<endl;
- int wybor;
- cin>>wybor;
- switch(wybor){
- case 1: break;
- case 2: break;
- case 3: break;
- default:
- cout<<"Zły numer"<<endl;
- menu();
- }
- }
- int main()
- {
- movie films[3];
- films[0].title= "Harry Potter";
- films[0].year= 2002;
- films[1].title= "SuperMan";
- films[1].year= 1997;
- films[2].title= "Batman";
- films[2].year= 1990;
- menu();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement