How can I get my output that is this
Symbol 1 / does match Symbol 2 *
Symbol 1 * does match Symbol 2 /
Symbol 1 ( does match Symbol 2 )
Symbol 1 [ does match Symbol 2 ]
Symbol 1 ( does match Symbol 2 )
End of program reached when unmatched symbol
Symbol 1 ( does match Symbol 2 ]
)
(
]
[
)
(
/
*
*
/
All Symbols correctly balanced

to look like this

Symbol 1 / *does match Symbol 2 */
Symbol 1 ( does match Symbol 2 )
Symbol 1 [ does match Symbol 2 ]
Symbol 1 ( does match Symbol 2 )
End of program reached when unmatched symbol
Symbol 1 ( does match Symbol 2 ]
)
(
]
[
)
(
/
*
*
/
All Symbols correctly balanced



code:--------------------------------------------------------------------------------
Code:
#include<iostream>
#include<fstream>
#include<iomanip> 
#include<cstdlib> 
#include<string>
#include"stackLL.h"
#include"StackLLImple.cpp"

using namespace std;

int main()
{
    char answer;
	char InputChar1, InputChar2;
    int Number=0;
	char num;
    int success=0;
	//string InputChar1;
	//string InputChar2;

	character link;
	int i=0;
	ifstream InFile;
	ofstream OutFile;

	InFile.open("input1.txt");
    OutFile.open("output2.txt");

    OutFile << "This is the the linked list function" << endl;
    OutFile<< "\n \n";

	InFile>>InputChar1;
	i++;
	InFile>>InputChar2;
	i++;
	while(InFile != NULL)
	{


	if((InputChar1 == '[') && (InputChar2 == ']') || (InputChar1 == ']') && (InputChar2 == '['))
	{
		 link.push(InputChar1);
		 link.push(InputChar2);
		 Number = 1;
		 
	}	 
	else if((InputChar1 == '(') && (InputChar2 == ')') || (InputChar1 == ')') && (InputChar2 == '('))
	{
		 link.push(InputChar1);
		 link.push(InputChar2);
		 Number = 1;
	}
		else if((InputChar1 == '/') && (InputChar2 == '*') || (InputChar1 == '*') && (InputChar2 == '/'))
	{
			link.push(InputChar1);
			link.push(InputChar2);
			Number = 1;
	}
else
Number = 2;
	
	
	switch (Number)
	{
 case 1: OutFile<<"Symbol 1 "<<InputChar1<<" does match Symbol 2 "<<InputChar2<<endl;
		Number =0;
		break;
	case 2 :OutFile<<" End of program reached when unmatched symbol"<<endl;
		OutFile<<"Symbol 1 "<<InputChar1<<" does match Symbol 2 "<<InputChar2<<endl;
while(i >2)
{
	OutFile<<link.pop(InputChar1)<<endl;
	i--;
	OutFile<<link.pop(InputChar2)<<endl;
	i--;
	
}
	Number = 3;
	case 3 :OutFile<<"All Symbols correctly balanced"<<endl;
	
	default: ;
	}
	
	
	InFile>>InputChar1;
	i++;
	InFile>>InputChar2;
	i++;
	}
	return 0;
}
	
#include<iostream>

//#include"stackLL.h"

using namespace std;
//constructor
character::character()
{
    head=NULL;
    cur=NULL;
    pre=NULL;
}

//destructor
character::~character()
{
    node *ptr;

    while(head!=NULL)     //delete all the numbers
    {
        ptr=head->next;
        delete head;
        head=ptr;
    }
}

char character:ush(char num)
{

 node *temp = new node;
    temp->num = num;
    temp->next = head;     // if head was NULL, next will now be NULL (end of list)
    head = temp;
return num;
}


//****remove at the head, this is stack, push at the head remove at the head.
char character:op(char num)
{
    //int num;
    node *temp = head;

    if (temp == NULL) return -1;

    num = temp->num;
    head = temp->next;
    delete temp;

    return num;


    //return success;
}


//this function will print from the beginning of the list to the end of the list
void character:rint()
{
    //if the list was empty print out an error message
    if(head==NULL)
    {
        cout << "There isn't any number" << endl;
        return;
    }

    //else while not the end of the list, print out the number and go to the next one
    else
    {
        cur=head;
        while(cur!=NULL)
        {
            cout << "number: " << cur->num << endl;
            cur=cur->next;
        }
    }
}


//the search function was search from the beginning of the head to the end of the
//head.
bool character::Isempty() const
{
	return (head == NULL);
}

int character::search(int num)
{

    if(head==NULL)     //if there isn't any data return 0
    {
        
        return 0;
    }

    if(head->num == num)        //if delete the first node
    {
        cout << num << " was found" << endl;
        
        return 1;
    }
    else        //else delete any node other than the first node
    {
        cur=head;
        cur=cur->next;


        while(cur!=NULL)    //search all the to the end of the list
        {

            if(cur->num ==num)
            {
                cout << num << " was found" << endl;
                

                return 1;
            }
            pre=cur;
            cur=cur->next;
            
        }// while
    } //else
return 0;
}
#include<iostream>
struct node
{
    char num;
    node *next;
};

class character
{
    public:
        character();
        ~character();

        char push(char num);
        char pop(char num);
        void print();
        int search(int num);
		bool Isempty() const;

    private:
        node *head;
        node *cur;
        node *pre;
};