SlideShare a Scribd company logo
1 of 2
Download to read offline
I need a complete working code for a solution to this problem using visual studio 2015:
C++ Programming (7th Edition)
Chapter 17, Problem 10PE
Solution
Ans:
#include
using namespace std;
class InfixToPostfix
{
private:char *p;//for infix expression
char *q;//for postfix expression
char *stack; //stack array
int top; //top
public: InfixToPostfix();//constructor
void getInfix();//ro read infix expression
void showInfix();//to display infix expression
void showPostfix();//to display postfix expression
void push(char ele);//to push elements into the stack
char pop();//to pop elements from stack
void convertToPostfix();//to convert infix to postfix
int precedence(char);//to find precedence of an operator
~InfixToPostfix();//destructor
};
InfixToPostfix::InfixToPostfix(void)
{
top=-1;
p=new char[100];
q=new char[100];
stack=new char[10];
}
void InfixToPostfix::getInfix(){
cout<<"enter infix expression:";
cin>>p;
}
void InfixToPostfix::showInfix(){
cout<<" Given Infix Expression: "<=precedence(*(p+i)) && top!=-1)
{
ch=pop();
q[j]=ch;j++;
}//end of while
push(*(p+i));//push next symbol into the stack
} //end of else
}//end of for loop
while(top!=-1)
{
ch=pop();
q[j]=ch;j++;
}
q[j]='0';
}//end of convertToPostfix()
void InfixToPostfix::showPostfix() //to display postfix expression
{
cout<<"Postfix Expression: "<

More Related Content

Similar to I need a complete working code for a solution to this problem using .pdf

C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
Jussi Pohjolainen
 
COMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdfCOMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdf
fazalenterprises
 
Data structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfData structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdf
armyshoes
 
prg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineeringprg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineering
SUNITHAS81
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
Little Tukta Lita
 

Similar to I need a complete working code for a solution to this problem using .pdf (20)

C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
Stack
StackStack
Stack
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
Oop Presentation
Oop PresentationOop Presentation
Oop Presentation
 
Programming Homework Help
Programming Homework Help Programming Homework Help
Programming Homework Help
 
COMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdfCOMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdf
 
Stack
StackStack
Stack
 
Data structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfData structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdf
 
Application of Stacks
Application of StacksApplication of Stacks
Application of Stacks
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
CS50 Lecture3
CS50 Lecture3CS50 Lecture3
CS50 Lecture3
 
stack-Intro.pptx
stack-Intro.pptxstack-Intro.pptx
stack-Intro.pptx
 
prg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineeringprg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineering
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
 
Stack
StackStack
Stack
 
Java AssignmentConvert infix to postfix.SolutionTo convert i.pdf
Java AssignmentConvert infix to postfix.SolutionTo convert i.pdfJava AssignmentConvert infix to postfix.SolutionTo convert i.pdf
Java AssignmentConvert infix to postfix.SolutionTo convert i.pdf
 
Fix the following C program in linux. When it is compiled it gives t.pdf
Fix the following C program in linux. When it is compiled it gives t.pdfFix the following C program in linux. When it is compiled it gives t.pdf
Fix the following C program in linux. When it is compiled it gives t.pdf
 
Write a program to convert a given INFIX into POSTFIX. Make sure .pdf
Write a program to convert a given INFIX into POSTFIX. Make sure .pdfWrite a program to convert a given INFIX into POSTFIX. Make sure .pdf
Write a program to convert a given INFIX into POSTFIX. Make sure .pdf
 
Sbaw091006
Sbaw091006Sbaw091006
Sbaw091006
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
 

More from michaelazach6427

Compare and contrast protein import into the ER and into the nucleus.pdf
Compare and contrast protein import into the ER and into the nucleus.pdfCompare and contrast protein import into the ER and into the nucleus.pdf
Compare and contrast protein import into the ER and into the nucleus.pdf
michaelazach6427
 
Ageism disproportionately affects women since they outlive me. T.pdf
Ageism disproportionately affects women since they outlive me. T.pdfAgeism disproportionately affects women since they outlive me. T.pdf
Ageism disproportionately affects women since they outlive me. T.pdf
michaelazach6427
 
Will th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdfWill th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdf
michaelazach6427
 
what is the transport process for a methane gas leakSolutionS.pdf
what is the transport process for a methane gas leakSolutionS.pdfwhat is the transport process for a methane gas leakSolutionS.pdf
what is the transport process for a methane gas leakSolutionS.pdf
michaelazach6427
 
Summarize the article Trading liberty for illusions by Wendy Kam.pdf
Summarize the article Trading liberty for illusions by Wendy Kam.pdfSummarize the article Trading liberty for illusions by Wendy Kam.pdf
Summarize the article Trading liberty for illusions by Wendy Kam.pdf
michaelazach6427
 
what is a shared derived charterer and how is it useful for construc.pdf
what is a shared derived charterer and how is it useful for construc.pdfwhat is a shared derived charterer and how is it useful for construc.pdf
what is a shared derived charterer and how is it useful for construc.pdf
michaelazach6427
 

More from michaelazach6427 (20)

Compare and contrast protein import into the ER and into the nucleus.pdf
Compare and contrast protein import into the ER and into the nucleus.pdfCompare and contrast protein import into the ER and into the nucleus.pdf
Compare and contrast protein import into the ER and into the nucleus.pdf
 
Discuss some of the various ways MySQL allows you to explore a datab.pdf
Discuss some of the various ways MySQL allows you to explore a datab.pdfDiscuss some of the various ways MySQL allows you to explore a datab.pdf
Discuss some of the various ways MySQL allows you to explore a datab.pdf
 
Dimitri and Rita eat some donuts for breakfast and then spend the mo.pdf
Dimitri and Rita eat some donuts for breakfast and then spend the mo.pdfDimitri and Rita eat some donuts for breakfast and then spend the mo.pdf
Dimitri and Rita eat some donuts for breakfast and then spend the mo.pdf
 
detail the importance of cell culture to the field of virologySo.pdf
detail the importance of cell culture to the field of virologySo.pdfdetail the importance of cell culture to the field of virologySo.pdf
detail the importance of cell culture to the field of virologySo.pdf
 
Ageism disproportionately affects women since they outlive me. T.pdf
Ageism disproportionately affects women since they outlive me. T.pdfAgeism disproportionately affects women since they outlive me. T.pdf
Ageism disproportionately affects women since they outlive me. T.pdf
 
Could you please help me on this questionThe duty cycle of a conv.pdf
Could you please help me on this questionThe duty cycle of a conv.pdfCould you please help me on this questionThe duty cycle of a conv.pdf
Could you please help me on this questionThe duty cycle of a conv.pdf
 
A random sample of five observations from the first population resul.pdf
A random sample of five observations from the first population resul.pdfA random sample of five observations from the first population resul.pdf
A random sample of five observations from the first population resul.pdf
 
Biomembranes contain many different types of lipid molecules. What a.pdf
Biomembranes contain many different types of lipid molecules. What a.pdfBiomembranes contain many different types of lipid molecules. What a.pdf
Biomembranes contain many different types of lipid molecules. What a.pdf
 
2. The Lorenz curve measures inequality in person income distributio.pdf
2. The Lorenz curve measures inequality in person income distributio.pdf2. The Lorenz curve measures inequality in person income distributio.pdf
2. The Lorenz curve measures inequality in person income distributio.pdf
 
1.) In some forms of epigenetic modification, when a gene is “marked.pdf
1.) In some forms of epigenetic modification, when a gene is “marked.pdf1.) In some forms of epigenetic modification, when a gene is “marked.pdf
1.) In some forms of epigenetic modification, when a gene is “marked.pdf
 
Will th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdfWill th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdf
 
The visual system that a mountain biker would use to identify changes.pdf
The visual system that a mountain biker would use to identify changes.pdfThe visual system that a mountain biker would use to identify changes.pdf
The visual system that a mountain biker would use to identify changes.pdf
 
Which of the following is NOT a benefit of breathing through the nose.pdf
Which of the following is NOT a benefit of breathing through the nose.pdfWhich of the following is NOT a benefit of breathing through the nose.pdf
Which of the following is NOT a benefit of breathing through the nose.pdf
 
Which is not a secure MAC address learning for port securityA. St.pdf
Which is not a secure MAC address learning for port securityA. St.pdfWhich is not a secure MAC address learning for port securityA. St.pdf
Which is not a secure MAC address learning for port securityA. St.pdf
 
what is the transport process for a methane gas leakSolutionS.pdf
what is the transport process for a methane gas leakSolutionS.pdfwhat is the transport process for a methane gas leakSolutionS.pdf
what is the transport process for a methane gas leakSolutionS.pdf
 
Summarize the article Trading liberty for illusions by Wendy Kam.pdf
Summarize the article Trading liberty for illusions by Wendy Kam.pdfSummarize the article Trading liberty for illusions by Wendy Kam.pdf
Summarize the article Trading liberty for illusions by Wendy Kam.pdf
 
what is a shared derived charterer and how is it useful for construc.pdf
what is a shared derived charterer and how is it useful for construc.pdfwhat is a shared derived charterer and how is it useful for construc.pdf
what is a shared derived charterer and how is it useful for construc.pdf
 
TF Unsaturated fatty acids have double or triple bonds creative kin.pdf
TF Unsaturated fatty acids have double or triple bonds creative kin.pdfTF Unsaturated fatty acids have double or triple bonds creative kin.pdf
TF Unsaturated fatty acids have double or triple bonds creative kin.pdf
 
samples, then compuie ine im samples, then cop me 9. Patient Waiting .pdf
samples, then compuie ine im samples, then cop me 9. Patient Waiting .pdfsamples, then compuie ine im samples, then cop me 9. Patient Waiting .pdf
samples, then compuie ine im samples, then cop me 9. Patient Waiting .pdf
 
The figure below shows two normal distributions. A and B. The distrib.pdf
The figure below shows two normal distributions. A and B. The distrib.pdfThe figure below shows two normal distributions. A and B. The distrib.pdf
The figure below shows two normal distributions. A and B. The distrib.pdf
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

I need a complete working code for a solution to this problem using .pdf

  • 1. I need a complete working code for a solution to this problem using visual studio 2015: C++ Programming (7th Edition) Chapter 17, Problem 10PE Solution Ans: #include using namespace std; class InfixToPostfix { private:char *p;//for infix expression char *q;//for postfix expression char *stack; //stack array int top; //top public: InfixToPostfix();//constructor void getInfix();//ro read infix expression void showInfix();//to display infix expression void showPostfix();//to display postfix expression void push(char ele);//to push elements into the stack char pop();//to pop elements from stack void convertToPostfix();//to convert infix to postfix int precedence(char);//to find precedence of an operator ~InfixToPostfix();//destructor }; InfixToPostfix::InfixToPostfix(void) { top=-1; p=new char[100]; q=new char[100]; stack=new char[10]; } void InfixToPostfix::getInfix(){ cout<<"enter infix expression:";
  • 2. cin>>p; } void InfixToPostfix::showInfix(){ cout<<" Given Infix Expression: "<=precedence(*(p+i)) && top!=-1) { ch=pop(); q[j]=ch;j++; }//end of while push(*(p+i));//push next symbol into the stack } //end of else }//end of for loop while(top!=-1) { ch=pop(); q[j]=ch;j++; } q[j]='0'; }//end of convertToPostfix() void InfixToPostfix::showPostfix() //to display postfix expression { cout<<"Postfix Expression: "<