Linked List, Stack and Queue
Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
P + ( Q - R ) * S / T
Conversion of the given Infix expression to its equivalent Postfix expression
(P+(((Q-R)*S)/T))
INFIX | STACK | POSTFIX |
( | ( | |
P | ( | P |
+ | (+ | P |
( | (+( | P |
Q | (+( | PQ |
- | (+(- | PQ |
R | (+(- | PQR |
) | (+ | PQR- |
* | (+* | PQR- |
S | (+* | PQR-S |
/ | (+/ | PQR-S* |
T | (+/ | PQR-S*T |
) | PQR-S*T/+ |
Sponsor Area
Write a function in C++ to read the content of a text file “DELHI.TXT” and display all those lines on the screen, which are either starting with ‘D’ or starting with ‘M’.
Write a function in C++ to search for the details (Phoneno and Calls) of those Phones, which have more than 800 calls from a binary file “phones.dat”. Assuming that this binary file contains records/objects of class Phone, which is defined below.
class Phone
{
char Phoneno[10]; int Calls;
public:
void Get( )
{
gets(Phoneno); cin>>Calls;
}
void Billing( )
{
cout<<Phoneno<<'#'<<Calls<<endl;
}
int GetCalls( )
{
return Calls;
}
};
Sponsor Area
Sponsor Area