1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Katena32 [7]
3 years ago
14

Hello, I am having trouble adding a txt file into a array, so I can pop it off for a postfix problem I have uploaded what I have

so far. I need help please
Computers and Technology
1 answer:
ExtremeBDS [4]3 years ago
7 0

Answer:

#include <stack>

#include<iostream>

#include<fstream> // to read imformation from files

#include<string>

using namespace std;

int main() {

   stack<string> data;

   ifstream inFile("postfix.txt");

   string content;

   if (!inFile) {

       cout << "Unable to open file" << endl;

       exit(1); // terminate with error

   }

   while (getline(inFile, content)) {

       data.push(content);

   }

   inFile.close();

   return 0;

}

Explanation:

You were very close. Use the standard <stack> STL library, and make sure the stack elements are of the same type as what you're trying to add, i.e., std::string.

You might be interested in
What does a coder do on a daily basis?
Gnoma [55]

medical charts and assinging codes

8 0
3 years ago
Can anyone give me Nitro type gold please? My NT account is trapkaybee061307
Rasek [7]

Answer:

no

Explanation:

3 0
3 years ago
Read 2 more answers
Describe email etiquette and netiquette when communicating electronically.
navik [9.2K]

Answer:

Email etiquette refers to the principles of behavior that one should use when writing or answering email messages. It is also known as the code of conduct for email communication. Email etiquette depends upon to whom we are writing- Friends & Relatives, Partners, Customers, Superior or Subordinates

Difference Between Etiquette and Netiquette is that Etiquette is the simple requirements needs for social behavior while Netiquette, is the code of acceptable behaviors users should follow while on the Internet.

6 0
3 years ago
4.2 code need help plz someone 15 points if u help
Korolek [52]

def func():  

 total = 0

 while True:

   pet = input("What pet do you have? ")

   if pet == "rock":

     return

   total += 1

   print("You have a {} with a total of {} pet(s)".format(pet, total))

func()

We wrapped our code in a function so that whenever the user enters rock, we can simply return and exit the function. If you have any other questions, I'll do my best to answer them.

8 0
3 years ago
Using C++.
butalik [34]
Alright -

So, we're going to create an object of type Calculator, with no additional information (which would be passed in the form of parameters). 

We would do this by saying: 

<em>Calculator calc;
</em>
Hopefully, this helps you! =)
4 0
3 years ago
Other questions:
  • Why is it important to use standard english when applying for a job
    13·2 answers
  • Need help ppplllleeeassse<br><br> Hhheeelllppp
    15·2 answers
  • Explain how a monitor can display the letters that you type on a keyboard. (Hint: Three Basic Computer Functions) *
    11·1 answer
  • A company wants to inform a select list of it's regular customers about a flash sale. Which type of platform will it use to send
    9·1 answer
  • What device connects a lan's switch to the next network? qizzlets?
    5·1 answer
  • I really need help with this question
    14·1 answer
  • True/False? In association rule learning, the following two rules will always have the same support value.
    9·1 answer
  • HOW DO I HACK PUBG MOBILE WITH PROOF <br>GIVE ME LINK​
    6·2 answers
  • Draw DFD diagram for phone sales. Help me. Thanks
    12·1 answer
  • When you start a new, blank document, you usually end up changing the font to arial 11. 5 point. How can you make these settings
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!