Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- using namespace std;
- int tab[10];
- void wys(){
- for(int i=0;i<10;i++){
- cout<<"["<<tab[i]<<"] ";
- }
- getchar();getchar();
- }
- void sortujB(){
- int j;
- for(int i=9;i>0;i--){
- for(j=0;j<i;j++){
- if(tab[j]>tab[j+1]) swap(tab[j],tab[j+1]);
- }
- }
- }
- void los(){
- srand(time(NULL));
- for(int i=0;i<10;i++){
- tab[i]=rand()%10;
- }
- }
- int main(){
- int wybor;
- do{
- system("cls");
- cout<<"x=1 - wyswietl tablice\n";
- cout<<"x=2 - losuj\n";
- cout<<"x=3 - sortuj babelkowo\n";
- cout<<"x=4 - wyjscie\n";
- cout<<"Wybor: ";
- cin>>wybor;
- switch(wybor){
- case 1:{wys();break;}
- case 2:{los();break;}
- case 3:{sortujB();break;}
- }}while(wybor!=4);
- }
Advertisement
Add Comment
Please, Sign In to add comment