Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7694627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:21:45+00:00 2026-05-31T21:21:45+00:00

This code is a linked list implementation of a stack that solves postfix problems

  • 0

This code is a linked list implementation of a stack that solves postfix problems in postfix.txt.

I stared the line that i am trying to convert.
I just want to make it a double before i put it on my stack so i cant do addition, subtraction, multiplication and division with it later. The error I get is saying “expected an expression”.
Thanks!

       void main()
        {
        ifstream postin("postfix.txt");
            char oper;
            char a[100];  
            int i=0;
            while(oper != '$')
            {
                stack operands;
                while(oper != '/n'&& oper != '$')
                {
                    while(oper != ' '&&oper != '/n'&& oper != '$')
                    {
                        oper = postin.get();
                        if(oper != '+' || oper != '*' || oper != '-' || oper != '/')
                        {
                            do
                            {
                            a[i]= oper;
                            i++;
                            }while(oper != ' ');
************************************************double number = atoi(a[]);
                            operands.Push(number)
                        }
                        else
                        {
                            double b = operands.Pop();
                            double a = operands.Pop();
                            if(oper == '+')
                            {
                                operands.Push(a+b);
                            }
                            else if(oper == '-')
                            {
                                operands.Push(a-b);
                            }
                            else if(oper == '/')
                            {
                                operands.Push(a/b);
                            }
                            else 
                            {
                                operands.Push(a*b);
                            }
                        }
                    }

                }

            }



        postin.close();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:21:46+00:00Added an answer on May 31, 2026 at 9:21 pm

    You don’t want to “Convert” the byte array, you want to parse the string representation of the number into the correct data type.

    First, you need to know if you’re going to be dealing with integers or floating point values. Then you’ll want to use scanf() or atoi()/atof() to read the values into an int or double. Those functions all take a char* argument though, so you’ll just pass a, not a[].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the C code that frees memory of a singly linked list. It
The following code is part of a stack implementation, implemented via a linked-list, in
I'm writing a simple linear linked list implementation in PHP. This is basically just
This code is not compiling in my system; I'm using Eclipse. // Linked list
I'm trying to print the list of a singly linked list that I referred
This is my implementation of insertion sort in java for doubly linked list. I
I am having some trouble running this linked list implementation (containing words as data).
I was writing this code for adding element at the end of linked list:
I'm trying to understand this code from Deitels 5th edition c book. If I'm
C++ question here. I've successfully (after some research :P) created a linked-list implementation for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.