Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <cstdio>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- int main()
- {
- int n,z,x;
- cout << "Podaj liczbe elemtow do wylosowania: ";
- cin >>n;
- cout << endl << "Podaj zakres losowanie od jakiej liczby ma byc losowane: ";
- cout << endl << "z: ";
- cin >> z;
- cout << endl << "x: ";
- cin >> x;
- int* tablica = new int[n]; // deklaracja tablicy o rozmiarze n
- for(int i = 0; i < n; i++)
- {
- tablica[i] = (rand() % x) + z; // wpisywanie do tablicy
- }
- for(int i = 0; i < n; i++)
- {
- cout << tablica[i] << " || "; // wyswietlenie
- }
- delete tablica; // zwolnienie pamieci
- getchar();
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment