Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <cstdio>
- #include <string>
- #include <conio.h>
- #include <cstdlib>
- using namespace std;
- int Osoby;
- int size_osoby=1;
- int size_grupy=1;
- int rowne = 0;
- int tez_rowne = 0;
- struct Dodawanie_osoby;
- struct Dodawanie_grupy;
- struct Dodawanie_osoby {
- string imie;
- string praca;
- int data_urodz;
- };
- struct Dodawanie_grupy {
- string miasto;
- string hobby;
- int dzien;
- int miesiac;
- int rok;
- };
- //------------------------------------------------------
- void dodawanie_osoby(Dodawanie_osoby*&osoba, int size_osoba) {
- cout << "Ile ? :";
- cin >> rowne;
- for (int i = 0; i < rowne; i++) {
- cout << "\nPodaj imie : ";
- cin.ignore();
- cout << "\nPodaj zawod : ";
- cin >> osoba->praca;
- cout << "\nPodaj rok urodzenia: ";
- cin >> osoba->data_urodz;
- }
- }
- void dodawanie_grupy(Dodawanie_grupy *grupy, int size_grupy) {
- system("cls");
- for (int i = 0; i < size_grupy; i++) {
- tez_rowne++;
- }
- }
- void dodawanie_grupy(Dodawanie_grupy *grupy) {
- cout << "\nPodaj miasto : ";
- cin >> grupy->miasto;
- cout << "\nPodaj, jakie hobby : ";
- cin >> grupy->hobby;
- cout << "\nPodaj dzien : ";
- cin >> grupy->dzien;
- cout << "\nPodaj miesiac : ";
- cin >> grupy->miesiac;
- cout << "\nPodaj rok : ";
- cin >> grupy->rok;
- }
- //-------------------------------------------------------
- void wyswietlanie_osob(Dodawanie_osoby *osoba, int size_osoba) {
- system("cls");
- if (rowne != 0) {
- for (int i = 0; i < rowne; i++) {
- cout << "\nOSOBA nr " << i + 1 << endl;
- cout << "\nIMIE : ";
- cout << osoba->imie;
- cout << "\nPRACA : ";
- cout << osoba->praca;
- cout << "\nRok zalozenia : ";
- cout << osoba->data_urodz;
- }
- }
- else cout << "brak osob";
- getchar();
- getchar();
- }
- void wyswietlanie_grupy(Dodawanie_grupy *grupa, int size_grupa) {
- system("cls");
- if (tez_rowne != 0) {
- for (int i = 0; i < size_grupa; i++) {
- cout << "\n\nGrupa " << i + 1 << " :\n";
- }
- }
- else cout << "\nBrak Grup\n";
- system("pause");
- }
- void wyswietlanie_grupy(Dodawanie_grupy *grupy) {
- cout << grupy->miasto << endl;
- cout << grupy->hobby << endl;
- cout << grupy->dzien << " - " << endl;
- cout << grupy->miesiac << " - " << endl;
- cout << grupy->rok << endl;
- }
- //------------------------------------------------------
- void kreator_grupy(Dodawanie_grupy *grupy) {
- grupy = new Dodawanie_grupy;
- }
- void usuwanie_grupy(Dodawanie_grupy *grupy) {
- delete grupy;
- }
- int menu(Dodawanie_osoby *osoba, Dodawanie_grupy *grupy) {
- char s = 0;
- dodawanie_osoby(osoba, size_osoby);
- do {
- cout << "\n" << endl;
- cout << " MENU" << "\n"
- << "\n"
- << "\t" << "1. <- OSOBY" << "\n\n"
- << "\t" << "2. <- GRUPY" << "\n\n";
- cin >> s;
- switch (s)
- {
- case '1': {
- wyswietlanie_osob(osoba, size_osoby);
- break;
- }
- case '2': {
- wyswietlanie_grupy(grupy, size_grupy);
- break;
- }
- case '3': {
- dodawanie_osoby(osoba, size_osoby);
- break;
- }
- case '4': {
- dodawanie_grupy(grupy, size_grupy);
- break;
- }
- case '5': {
- goto A;
- break;
- }
- }
- system("cls");
- } while (s != 5);
- A:
- return 0;
- }
- void main()
- {
- Dodawanie_osoby *person;
- Dodawanie_grupy *group;
- dodawanie_osoby(person, size_osoby);
- //menu();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement