Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main(){
- int aSize = 30;
- char again = 'y';
- while (again == 'y' | again == 'Y'){
- vector <int> INT(aSize);
- for (int i = 0; i < aSize; i++){ //assign value
- cout << "Enter value for array INT at position " << i << ": ";
- cin >> INT.at(i);
- }
- vector <int> INT1(INT); //copy arrays
- cout << "\nThe value of INT1 at position 5 is: " << INT1.at(5) //get value at 5
- << "\nThe capacity of INT1 array is: " << INT1.capacity() << endl
- << "The values of the INT1 are: \n";
- for (int x = 0; x < aSize; x++){
- cout << INT1.at(x) << ",";
- if ((x+1) == aSize){ //clear if 30
- INT1.clear();
- cout << "\n\n";
- }
- }
- cout << "\nIs INT1 clear? " << INT1.empty();
- cout << "\nEnter y or Y to go again: ";
- cin >> again;
- }
- }
Add Comment
Please, Sign In to add comment