/* * File: warmup.cpp * Author: Michael H. Goldwasser * Date: 05 January 2005 * * This is a partially written source code for a programming * assignment. The eventual goal is to gain practice in various * syntactical issues involving the use of both locally and * dynamically declared arrays and vectors. */ #include #include #include using namespace std; /*********************************************** * Place your various subroutines here ***********************************************/ int main() { /**************************************************************** * Phase 0: ask user how many numbers to be given ****************************************************************/ int n; cout << "How many number will follow? "; cin >> n; /**************************************************************** * Phase 1: read data into array and vector declared "locally" ****************************************************************/ double A[n]; vector V(n); // read the data here... // echo the contents of A and V to the standard output cout << "=================== phase 1 ===================\n"; cout << "-----Array A contents-----\n"; // call print routine for A cout << "-----Vector V contents-----\n"; // call print routine for V /**************************************************************** * Phase 2: locally declare array B and vectors W and X, * copying data from original structures as described in assignment * * Then reverse contents of these copies. * Then print contents of both original and copies. ****************************************************************/ // Locally declare B, W and X here, ensuring that data is cloned // call reversal subroutine for B, W and X // echo the contents of new and original structures cout << "=================== phase 2 ===================\n"; cout << "-----Array A contents-----\n"; // call print routine for A cout << "-----Array B contents-----\n"; // call print routine for B cout << "-----Vector V contents-----\n"; // call print routine for V cout << "-----Vector W contents-----\n"; // call print routine for W cout << "-----Vector X contents-----\n"; // call print routine for X /**************************************************************** * Phase 3: dynamically declare array C and vectors Y and Z, * copying data from original structures as described in assignment * * Then reverse contents of these copies. * Then print contents of both original and copies. ****************************************************************/ // Dynamically declare C, Y and Z here, ensuring that data is cloned // call reversal subroutine for C, Y and Z // echo the contents of new and original structures cout << "=================== phase 3 ===================\n"; cout << "-----Array A contents-----\n"; // call print routine for A cout << "-----Array C contents-----\n"; // call print routine for C cout << "-----Vector V contents-----\n"; // call print routine for V cout << "-----Vector Y contents-----\n"; // call print routine for Y cout << "-----Vector Z contents-----\n"; // call print routine for Z return EXIT_SUCCESS; }