Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.cpp
- #include "ex_function.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- float* rand_arr = vec_random(4,false);
- for (int i = 0; i < 4; i++)
- cout << " " << rand_arr[i];
- cout << endl;
- delete[] rand_arr;
- return 0;
- }
- //vec_random.cpp
- #include "omp.h"
- #include "stdlib.h"
- #include "time.h"
- #include "ex_function.h"
- float* vec_random(int n, bool normal)
- {
- float* rand_arr = new float[n];
- // ----------------------------------------------------------
- //
- // ----------------------------------------------------------
- if (normal)
- {
- #pragma omp barrier
- vec_random_norm(rand_arr, n);
- }
- // ----------------------------------------------------------------------------------------
- // -- весь код между этим комментарием и комментарий 1 должен быть в параллельной области--
- // ----------------------------------------------------------------------------------------
- return rand_arr;
- }
- //vec_random_norm.cpp
- #include "omp.h"
- #include <iostream>
- using namespace std;
- void vec_random_norm(float* rand_arr, int n)
- {
- }
- //ex_function.h
- #pragma once
- float* vec_random(int n,bool normal);
- void vec_random_norm(float* rand_arr, int n);
Add Comment
Please, Sign In to add comment