Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Monday at 12:26 PM
Windows RDP Only Rs.500 a month
Blogerwiki
Updated:
Sunday at 12:41 PM
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
FREE SEO Check & Google Maps Check for Sri Lankan Businesses | Web Design, Website Price Rs 14,900 |
LankaSolve
Updated:
Oct 20, 2026
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Oct 17, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
A Thread for Programmers.!
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Core" data-source="post: 7825971" data-attributes="member: 263471"><p><img src="/styles/default/xenforo/smilies/default/rolleyes.gif" class="smilie" loading="lazy" alt=":rolleyes:" title="Rolleyes :rolleyes:" data-shortname=":rolleyes:" /></p><p></p><p></p><p><span style="font-family: 'Fixedsys'">[CODE]</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'">/*\</span></p><p><span style="font-family: 'Fixedsys'">Write a C++ program to convert any infix expression to its post-fix form....</span></p><p><span style="font-family: 'Fixedsys'">Eg-</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'">if user enters a+b</span></p><p><span style="font-family: 'Fixedsys'">it should print ab+</span></p><p><span style="font-family: 'Fixedsys'">\*/</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'">#include <iostream></span></p><p><span style="font-family: 'Fixedsys'">#include <iomanip></span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'">using std::cin;</span></p><p><span style="font-family: 'Fixedsys'">using std::endl;</span></p><p><span style="font-family: 'Fixedsys'">using std::cout;</span></p><p><span style="font-family: 'Fixedsys'">using std::setw;</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'">int main()</span></p><p><span style="font-family: 'Fixedsys'">{</span></p><p><span style="font-family: 'Fixedsys'"> int hold=0;</span></p><p><span style="font-family: 'Fixedsys'"> const int max=100;</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'"> char string[max] = {0};</span></p><p><span style="font-family: 'Fixedsys'"> char repeat('n');</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'"> char stringExp[max] = {0};</span></p><p><span style="font-family: 'Fixedsys'"> char stringSymbol[max] = {0};</span></p><p><span style="font-family: 'Fixedsys'"> int j=0;</span></p><p><span style="font-family: 'Fixedsys'"> int i=0;</span></p><p><span style="font-family: 'Fixedsys'"> int k=0;</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'"> cout << setw(2) << "Type any Expression to proceed" << endl;</span></p><p><span style="font-family: 'Fixedsys'"> cin.getline(string,max,'\n');</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'"> cout << endl;</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'"> while(string[i] != '\0') //till it reaches the null character</span></p><p><span style="font-family: 'Fixedsys'"> {</span></p><p><span style="font-family: 'Fixedsys'"> if('9' >= string[i] && '0' <= string[i]) </span></p><p><span style="font-family: 'Fixedsys'"> {</span></p><p><span style="font-family: 'Fixedsys'"> stringExp[k] = string[i];</span></p><p><span style="font-family: 'Fixedsys'"> k++;</span></p><p><span style="font-family: 'Fixedsys'"> }else </span></p><p><span style="font-family: 'Fixedsys'"> {</span></p><p><span style="font-family: 'Fixedsys'"> stringSymbol[j] = string[i];</span></p><p><span style="font-family: 'Fixedsys'"> j++;</span></p><p><span style="font-family: 'Fixedsys'"> }</span></p><p><span style="font-family: 'Fixedsys'"> i++;</span></p><p><span style="font-family: 'Fixedsys'"> }</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'"> cout << endl;</span></p><p><span style="font-family: 'Fixedsys'"> cout << "Final Out Put " << stringExp << stringSymbol ;</span></p><p><span style="font-family: 'Fixedsys'"> cout << endl;</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'"> cin >> hold;</span></p><p><span style="font-family: 'Fixedsys'"> return 0;</span></p><p><span style="font-family: 'Fixedsys'">}</span></p><p><span style="font-family: 'Fixedsys'"></span></p><p><span style="font-family: 'Fixedsys'">[/CODE]</span></p></blockquote><p></p>
[QUOTE="Core, post: 7825971, member: 263471"] :rolleyes: [FONT=Fixedsys][CODE] /*\ Write a C++ program to convert any infix expression to its post-fix form.... Eg- if user enters a+b it should print ab+ \*/ #include <iostream> #include <iomanip> using std::cin; using std::endl; using std::cout; using std::setw; int main() { int hold=0; const int max=100; char string[max] = {0}; char repeat('n'); char stringExp[max] = {0}; char stringSymbol[max] = {0}; int j=0; int i=0; int k=0; cout << setw(2) << "Type any Expression to proceed" << endl; cin.getline(string,max,'\n'); cout << endl; while(string[i] != '\0') //till it reaches the null character { if('9' >= string[i] && '0' <= string[i]) { stringExp[k] = string[i]; k++; }else { stringSymbol[j] = string[i]; j++; } i++; } cout << endl; cout << "Final Out Put " << stringExp << stringSymbol ; cout << endl; cin >> hold; return 0; } [/CODE][/FONT] [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom