Advertisement
Guest User

xx1

a guest
Oct 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.33 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <cstdio>
  4. #include <string>
  5. #include <conio.h>
  6. #include <cstdlib>
  7.  
  8.  
  9. using namespace std;
  10. int Osoby;
  11. int size_osoby=1;
  12. int size_grupy=1;
  13. int rowne = 0;
  14. int tez_rowne = 0;
  15.  
  16. struct Dodawanie_osoby;
  17. struct Dodawanie_grupy;
  18.  
  19.  
  20. struct Dodawanie_osoby {
  21.     string imie;
  22.     string praca;
  23.     int data_urodz;
  24.  
  25. };
  26.  
  27. struct Dodawanie_grupy {
  28.     string miasto;
  29.     string hobby;
  30.     int dzien;
  31.     int miesiac;
  32.     int rok;
  33. };
  34. //------------------------------------------------------
  35. void dodawanie_osoby(Dodawanie_osoby*&osoba, int size_osoba) {
  36.    
  37.  
  38.     cout << "Ile ? :";
  39.     cin >> rowne;
  40.  
  41.     for (int i = 0; i < rowne; i++) {
  42.         cout << "\nPodaj imie : ";
  43.         cin.ignore();
  44.  
  45.         cout << "\nPodaj zawod : ";
  46.         cin >> osoba->praca;
  47.  
  48.         cout << "\nPodaj rok urodzenia: ";
  49.         cin >> osoba->data_urodz;
  50.     }
  51. }
  52.  
  53. void dodawanie_grupy(Dodawanie_grupy *grupy, int size_grupy) {
  54.     system("cls");
  55.  
  56.     for (int i = 0; i < size_grupy; i++) {
  57.  
  58.         tez_rowne++;
  59.     }
  60. }
  61.  
  62. void dodawanie_grupy(Dodawanie_grupy *grupy) {
  63.  
  64.     cout << "\nPodaj miasto : ";
  65.     cin >> grupy->miasto;
  66.  
  67.     cout << "\nPodaj, jakie hobby : ";
  68.     cin >> grupy->hobby;
  69.  
  70.     cout << "\nPodaj dzien : ";
  71.     cin >> grupy->dzien;
  72.  
  73.     cout << "\nPodaj miesiac : ";
  74.     cin >> grupy->miesiac;
  75.  
  76.     cout << "\nPodaj rok : ";
  77.     cin >> grupy->rok;
  78.  
  79. }
  80.  
  81. //-------------------------------------------------------
  82. void wyswietlanie_osob(Dodawanie_osoby *osoba, int size_osoba) {
  83.  
  84.     system("cls");
  85.  
  86.     if (rowne != 0) {
  87.         for (int i = 0; i < rowne; i++) {
  88.             cout << "\nOSOBA nr " << i + 1 << endl;
  89.             cout << "\nIMIE : ";
  90.             cout << osoba->imie;
  91.  
  92.             cout << "\nPRACA : ";
  93.             cout << osoba->praca;
  94.  
  95.             cout << "\nRok zalozenia : ";
  96.             cout << osoba->data_urodz;
  97.         }
  98.     }
  99.     else cout << "brak osob";
  100.  
  101.     getchar();
  102.     getchar();
  103. }
  104.  
  105. void wyswietlanie_grupy(Dodawanie_grupy *grupa, int size_grupa) {
  106.  
  107.     system("cls");
  108.  
  109.     if (tez_rowne != 0) {
  110.         for (int i = 0; i < size_grupa; i++) {
  111.             cout << "\n\nGrupa " << i + 1 << " :\n";
  112.  
  113.         }
  114.     }
  115.     else cout << "\nBrak Grup\n";
  116.     system("pause");
  117. }
  118.  
  119. void wyswietlanie_grupy(Dodawanie_grupy *grupy) {
  120.  
  121.     cout << grupy->miasto << endl;
  122.     cout << grupy->hobby << endl;
  123.     cout << grupy->dzien << " - " << endl;
  124.     cout << grupy->miesiac << " - " << endl;
  125.     cout << grupy->rok << endl;
  126.  
  127. }
  128. //------------------------------------------------------
  129. void kreator_grupy(Dodawanie_grupy *grupy) {
  130.  
  131.     grupy = new Dodawanie_grupy;
  132. }
  133.  
  134. void usuwanie_grupy(Dodawanie_grupy *grupy) {
  135.  
  136.     delete grupy;
  137. }
  138.  
  139.  
  140. int menu(Dodawanie_osoby *osoba, Dodawanie_grupy *grupy) {
  141.  
  142.     char s = 0;
  143.     dodawanie_osoby(osoba, size_osoby);
  144.  
  145.     do {
  146.         cout << "\n" << endl;
  147.         cout << "                    MENU" << "\n"
  148.             << "\n"
  149.             << "\t" << "1.  <-  OSOBY" << "\n\n"
  150.             << "\t" << "2.  <-  GRUPY" << "\n\n";
  151.  
  152.         cin >> s;
  153.  
  154.         switch (s)
  155.         {
  156.         case '1': {
  157.             wyswietlanie_osob(osoba, size_osoby);
  158.             break;
  159.         }
  160.         case '2': {
  161.  
  162.             wyswietlanie_grupy(grupy, size_grupy);
  163.             break;
  164.         }
  165.         case '3': {
  166.             dodawanie_osoby(osoba, size_osoby);
  167.             break;
  168.         }
  169.         case '4': {
  170.             dodawanie_grupy(grupy, size_grupy);
  171.             break;
  172.         }
  173.  
  174.         case '5': {
  175.             goto A;
  176.             break;
  177.         }
  178.  
  179.         }
  180.  
  181.         system("cls");
  182.     } while (s != 5);
  183.  
  184.  
  185. A:
  186.  
  187.     return 0;
  188. }
  189.  
  190.  
  191. void main()
  192. {
  193.     Dodawanie_osoby *person;
  194.     Dodawanie_grupy *group;
  195.  
  196.     dodawanie_osoby(person, size_osoby);
  197.     //menu();
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement