Witam, borykam się z problemem. Wykonuję na zaliczenie ćwiczenie (zdjęcie 1). Mam problem z dodawaniem szkoleń i trenerów. Ktoś jest w stanie pomóc lub nakierować? Od razu zaznaczam, że wybitnym programistą nie jestem, co za pewne widać, ale próbuję.
Kod pliku:
> #include <iostream>
> #include <stdio.h>
> #include <cstdlib>
> #include <conio.h>
>
> using namespace std;
>
> char wybor;
>
> string Szkolenie;
> string Trener;
> string Przydzial;
>
> int main()
> {
> cout << "MENU" << endl;
> cout << "1. Szkolenia z danego okresu czasu." << endl;
> cout << "2. Szkolenia przydzielone do trenera." << endl;
> cout << "3. Dodaj szkolenie." << endl;
> cout << "4. Dodaj trenera." << endl;
>
> cout << "Wybierz jedna z powyzszych opcji." << endl;
> cout << "Wybor: ";
> wybor=getch();
>
> switch(wybor)
> {
> case '1':
> {
> cout << "Podaj okres szkolen, ktory Cie interesuje: " << endl;
> }
> break;
>
> case '2':
> {
> cout << "Podaj nazwisko trenera: " << endl;
> }
> case '3':
> {
> void szkolenie::dodaj;
> }
> case '4':
> {
> void trener::dodaj;
> }
> }
> getchar();getchar();
> system("cls");
>
> return 0;
> }
Kod klas:
> #include <iostream>
>
> using namespace std;
>
> class Szkolenie
>
> {
> private:
>
> int id_szkolenia;
> string nazwa_szkolenia;
> string data_rozpoczecia;
> string dlugosc_szkolenia;
>
> public:
>
> void szkolenie::dodaj()
> {
> cout << "Nazwa szkolenia: " << endl; cin >> nazwa_szkolenia;
> cout << "Data rozpoczecia szkolenia: " << endl; cin >> data_rozpoczecia;
> cout << "Dlugosc szkolenia: " << endl; cin >> dlugosc_szkolenia;
> }
>
> void save()
> {
> ofstream plik("szkolenia.txt");
> for
> plik.close();
> };
>
> class Trener
>
> {
> private:
>
> int id_trenera;
> string nazwisko_trenera;
>
> public:
>
> void trener::dodaj()
> {
> cout << "Podaj nazwisko trenera: " << endl; cin >> nazwisko_trenera;
>
> }
>
> void save()
> {
> ofstream plik("trenerzy.txt");
> for
> plik.close();
> };
> }