Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //find the final element
- int index;
- for (int i = myArray.size() - 1; i > -1; i--) {
- if (myArray[i] != 0) {
- index = i+1;
- break; }
- }
- //print out to that element
- for (int i = 0; i <= index; i++) {
- std::cout << myArray[i] << "\t";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement