Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void wprowadzanie(int l[],int r)
- {
- for(int i=0; i<r; i++)
- {
- cout<<"Podaj liczbe nr"<<i<<": ";
- cin>>l[i];
- }
- }
- void sortowanie(int l[],int r)
- {
- for(int i=0; i<r-1;i++)
- {
- for(int j=0; j<r-1; j++)
- {
- if(l[j]>l[j+1])
- {
- swap(l[j],l[j+1]);
- }
- }
- }
- }
- void wyswMAKS(int l[])
- {
- cout<<"Trzy najwieksze liczby to: "<<l[9]<<", "<<l[8]<<", "<<l[7]<<".";
- }
- void wyswMIN(int l[])
- {
- cout<<"Trzy najmniejsze liczby to: "<<l[0]<<", "<<l[1]<<", "<<l[2]<<".";
- }
- int main()
- {
- int wp[10];
- int wybor;
- wprowadzanie(wp,10);
- sortowanie(wp,10);
- cout<<"Co chcesz zrobic?"<<endl;
- cout<<"_________________________________"<<endl;
- cout<<"1. Wyswietl 3 najwieksze liczby."<<endl;
- cout<<"2. Wyswietl 3 najmniejsze liczby."<<endl;
- cout<<"_________________________________"<<endl;
- while(true){
- cout<<"Wybierz opcje: ";
- cin>>wybor;
- switch(wybor)
- {
- case 1:
- wyswMAKS(wp);
- break;
- case 2:
- wyswMIN(wp);
- break;
- }
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement