Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- struct katalog
- {
- char nazwa[30];
- char autor[30];
- int rok;
- };
- int main()
- {
- int n;
- cout << "Ile elementow ma miec tablica ?";
- cin >> n;
- katalog spis[30];
- katalog *nspis = new katalog[n];
- float licznik = 0;
- for (int i = 0; i < n; i++)
- {
- cout << "" << i + 1 << " Ksiazka" << endl;
- cout << "Nazwa ksiazki: "; cin >> nspis[i].nazwa;
- cout << "Autor: "; cin >> nspis[i].autor;
- cout << "Rok wydania: "; cin >> nspis[i].rok;
- licznik++;
- }
- cout << "Wprowadziles " << licznik << " ksiazek do bazy" << endl;
- int a;
- cout << "Ktory element bazy wyswietlic? \n Ktory: ";
- cin >> a;
- if (a<0 || a>n)
- cout << "Nie ma takiego numeru w bazie!";
- else
- cout << nspis[a - 1].nazwa << ", " << nspis[a - 1].autor << ", " << nspis[a - 1].rok << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement