Computer Science > STUDY GUIDE > Texas A&M University - CSCE 121stack.cpp (All)
#include "stack.h" #include <iostream> #include<cmath> using namespace std; void push(Stack& s, double element) { if(s.length == s.capacity){ s.capacity *= 2; double* ar = new double[s.capacit ... y]; for(int i=0; i<s.length; i++){ ar[i] = s.A[i]; } s.A = ar; delete []ar; } s.A[s.length] = element; s.length++; } // remove and return the element on top of Stacks // if Stack s is empty, return NAN double pop (Stack& s) { if(s.length==0){ return NAN; } s.length--; [Show More]
Last updated: 3 years ago
Preview 1 out of 2 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 04, 2021
Number of pages
2
Written in
All
This document has been written for:
Uploaded
Apr 04, 2021
Downloads
0
Views
70
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·