Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to use "getline"?

Posted on 1998-10-24
5
Medium Priority
?
224 Views
Last Modified: 2010-04-02
how to use the function "getline" in order to get a string input from keyboard?

moreover, how to change an infix math expression to postfix by using stack?
e.g. 1 + 2 * 3
will be
1 2 3 * +

tks!!
0
Comment
Question by:chuyan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Expert Comment

by:newexpert
ID: 1176000
cin.getline(char *yourbuf, int max_length_allowed, char line_terminator_to_look_for);

If you use the latest STL, then it's simply cin.getline(string your_string, char terminator);
0
 

Author Comment

by:chuyan
ID: 1176001
oh yup! tks!!
0
 

Author Comment

by:chuyan
ID: 1176002
Edited text of question
0
 
LVL 22

Accepted Solution

by:
nietod earned 60 total points
ID: 1176003
>> how to change an infix math expression to postfix by using stack?
We can provided limited help on school assignments.  We can answer questions, like you might ask your teacher and we can review your work and provides suggetions  and criticism.

But I think I can say this much.  You will have a recursive procedure that parses the expression.  When it comes to the left operand.  It places it on the stack.  When it comes to the operator, it stores it temporarily in a local variable and calls itself to to process the rest of the expression.  When it returns it places the operator on the stack and then returns to the caller.

Give it a try.
0
 

Author Comment

by:chuyan
ID: 1176004
tks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question