Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int n = 10;
- int vivodA (int *A, int n){ //n - numberOfElements, число чисел
- for (int i=0; i<n; ++i){
- A[i]=i;
- cout<<A[i]<<" ";
- }
- }
- int vivodB (int *B, int k ){ // B в 2 раза короче, чем А, зависит от сколько А
- for (int i=0; i < k; ++i){
- B[i]=i;
- cout<<B[i]<<" ";
- }
- }
- int vivodC (int *C, int f){
- for (int i=f; i <n; ++i){
- C[i]=i;
- cout<<C[i]<<" ";
- }
- }
- int splitA( int *A, int *B, int *C, int n){
- for (int i=0; i < n/2; ++i){
- B[i]=A[n-n+i];
- C[i]=A[n-n/2+i];
- cout<<B[i]<<C[i]<<" "<<'\n';
- }
- }
- int main()
- {
- const int n = 10;
- int* A = new int[n];
- int* B = new int[n/2];
- int* C = new int[n/2];
- vivodA ( A, n);
- cout << '\n';
- vivodB ( B, n/2);
- cout << '\n';
- vivodC ( C, n/2);
- cout << '\n';
- cout << '\n';
- splitA( A, B ,C , n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement