Consider the following pseudocode:
declare a stack of characters
while ( there are more characters in the word to read )
{
read a character
push the character on the stack
}
while ( the stack is not empty )
{
write the stack's top character to the screen
pop a character off the stack
}
write c++ code for above
1
Expert's answer
2021-09-15T04:59:00-0400
#include<iostream>
#include<stack>
using namespace std;
int main(){
char s[] = "geeksquiz";
stack<char>s1;
int i =0;
while(s[i]){
s1.push(s[i]);
i++;
}
while ( !s1.empty())
{
cout<<s1.top()<<" ";
s1.pop();
}
}
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment