Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- void stampaVettore(int* puntatore, int dimensione) {
- for(int i = 0; i < dimensione; i++) {
- cout << *puntatore << endl;
- puntatore++;
- }
- }
- int* riempiVettoreCasualmente(int* puntatore, int dimensione) {
- int* temp = puntatore;
- for(int i = 0; i < dimensione; i++) {
- *temp = rand() % 25;
- temp++;
- }
- return puntatore;
- }
- int main() {
- srand(time(NULL));
- const int DIMENSIONE = 10;
- int vettore[DIMENSIONE] = {0};
- int* puntatore = riempiVettoreCasualmente(vettore, DIMENSIONE);
- stampaVettore(puntatore, DIMENSIONE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement