Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication27.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <time.h>
- using namespace std;
- void czytaj(int tab[]) {
- for (int i = 0; i < 10; i++) {
- cout << tab[i] << " ";
- }
- cout << endl;
- }
- void reverse(unsigned int n, int tab[]) {
- for (int i = 0; i < n / 2; i++) {
- int pom = tab[i];
- tab[i] = tab[n - 1 - i];
- tab[n - 1 - i] = pom;
- }
- }
- int main()
- {
- int n = 5;
- int tab[10];
- srand(time(NULL));
- for (int i = 0; i < 10; i++) {
- tab[i] = rand();
- }
- czytaj(tab);
- reverse(n, tab);
- czytaj(tab);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement