October 2018 1 18 Report

Czy to jest dobrze? Gdzie i jak mogę ewentualnie poprawić jakiś błąd?

#include <iostream>
#include <iomanip>
#include <cstdio>
using namespace std;

void zamien (int &a, int &b)
{
int temp=a;
a=b;
b=temp;
}

void sortowanie_przez_wybor(int tab[], int n)
{
int i, j, k, temp;
for (i=0; i<n; i++)
{
k=i;
for (j=i+1; j<n; j++)
if (tab[j]<tab[k])
k=j;
zamien(tab[k],tab[i]);
}
}

void wyswietl (int tab[], int n)
{
for (int i=0; i<n; i++)
{
cout<<setw(3)<<tab[i];
}
cout<<endl;
}

int main ()
{
int tablica[5];
int i;
for (i=0; i<5; i++)
tablica [i]=(3)%100;
cout<<"Podaj wartosc: "<<endl;
wypisz(tablica[5]);
cout<<"Posortowane: "<<endl;
sortowanie_przez_wybor(tablica[5]);
wypisz(tablica[5]);
getchar();
return 0;
}


More Questions From This User See All

Recommend Questions



Life Enjoy

" Life is not a problem to be solved but a reality to be experienced! "

Get in touch

Social

© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.