Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE HOW DO I FIX THE ERRORS AND COMPLETE THIS C++ PROGRAM IN A LOOP? #include

ID: 3922293 • Letter: P

Question

PLEASE HOW DO I FIX THE ERRORS AND COMPLETE THIS C++ PROGRAM IN A LOOP?

#include <iostream>

using namespace std;

struct st
{
    char ch;
    st *next;
};

class stack
{
public:
    stack();
    ~stack();
    void push(??);
    ?? pop();
   
private:
    st *top;
};

void stack::push(char c)
{
    stack ob1;
    char ch1;
   
    if !(is full())
        cin >> chl;
    ob1 push(ch1);
}

if !(is empty())
{
    ch1 = ob1.pop();
}

void stack::push(char c)
{
    temp->ch = c;
    temp->next = top;
    top = temp;
}

char stack::push()
{
    char t;
    t = top->ch;
   
    return (top->ch)
}

char stack::pop()
{
    st *temp;
    temp = top;
    top = top;
    t = temp->ch;
    delete temp;
    return t;
}

Explanation / Answer

#include <iostream>

using namespace std;

struct st
{
    char ch;
    st *next;
};

class stack
{
public:
    stack();
    ~stack();
    void push(??);
    ?? pop();
    
private:
    st *top;
};

void stack::push(char c)
{
    stack ob1;
    char ch1;
    
    if !(is full())
        cin >> chl;
    ob1 push(ch1);
}

if !(is empty())
{
    ch1 = ob1.pop();
}

void stack::push(char c)
{
    temp->ch = c;
    temp->next = top;
    top = temp;
}

char stack::push()
{
    char t;
    t = top->ch;
    
    return (top->ch)
}

char stack::pop()
{
    st *temp;
    temp = top;
    top = top;
    t = temp->ch;
    delete temp;
    return t;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote