Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <windows.h>
- using namespace std;
- struct profesja{
- char nazwa[30];
- float atrybut;
- };
- void zamiana(int &a, int &b)
- {
- int temp=a;
- a=b;
- b=temp;
- }
- void sortowanie(int tab[], int n)
- {
- int i,k,j;
- for(i=0;i<n-1;i++)
- {
- k=i;
- for(j=i+1;j<n;j++)
- {
- if(j<n) if(tab[j]<tab[k]) k=j;
- }
- zamiana(tab[i],tab[k]);
- }
- }
- int main()
- {
- profesja tab[5];
- for (int i=0;i<5;i++)
- {
- cout << "podaj nazwe " << i+1 << " klasy: ";
- cin >> tab[i].nazwa;
- cout << "podaj atrybut " << i+1 << " postaci: ";
- cin >> tab[i].atrybut;
- }
- cout << endl;
- for (int j=0;j<5;j++)
- {
- cout << j+1 << ". RASA: " << tab[j].nazwa << "\t" << " ATRYBUT: " << tab[j].atrybut << endl;
- }
- cout << endl;
- int a;
- do
- {
- cout << "ilosc postaci do konfrontacji: ";
- cin >> a;
- }while(a>=5);
- int tab2[5];
- for (int k=0;k<a;k++)
- {
- cout << "wybierz numer pozycji postaci do porownania: ";
- cin >> tab2[k];
- };
- cout << endl << "WYBRALES: ";
- for(int l=0;l<a;l++)
- {
- cout << tab[tab2[l]-1].nazwa << endl;
- }
- for(int m=0;m<a;m++)
- {
- cout
- cin.ignore();
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement