<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4032756259402712644</id><updated>2026-03-06T08:09:51.660-08:00</updated><category term="Basic Problems"/><category term="QTProgramming"/><category term="C Tutorials"/><category term="Loops"/><category term="Simple C plus plus Programs"/><category term="C/C++ Shapes"/><category term="DataStructures"/><category term="Videos"/><category term="Urdu Training"/><category term="nested loop"/><category term="solution"/><category term="Learn C++"/><category term="arrays"/><category term="C++ Shapes Code"/><category term="C++ Basic Problems"/><category term="Ds malik"/><category term="Loops practice using shapes"/><category term="C++ Tutorials"/><category term="c++ projects"/><category term="C++ Books Solution"/><category term="Temperature 5 Scale Converter"/><category term="oop1ch2e"/><category term="C++ Language"/><category term="C++ Tips and Tricks"/><category term="Object Oriented Programming in C++  by Robert Lafore - 4th Edition Chapter 2"/><category term="C Projects"/><category term="C++ Programs"/><category term="Sorting"/><category term="Additional Questions"/><category term="C Structures"/><category term="C++ Loops and Decisions"/><category term="C++ Program Examples"/><category term="CppStruct"/><category term="File Handling in C++"/><category term="OOP"/><category term="Object Oriented Programming in C++  by Robert Lafore - 4th Edition Chapter 3"/><category term="Strings"/><category term="else if nested if"/><category term="if statement"/><category term="Advantages of C over C++"/><category term="C++ Functions"/><category term="array programs"/><category term="cppexamples"/><category term="C Primer Plus"/><category term="C plus plus project"/><category term="CPP Pointers"/><category term="Object-Oriented Programming in C++ Fourth Edition Solution Manual"/><category term="c language projects"/><category term="c programming sample projects"/><category term="how to learn c language"/><category term="how to learn c programming"/><category term="language c"/><category term="learn c programming"/><category term="list of all the C++ keywords"/><category term="oop1ch3e"/><category term="C programs"/><category term="C++ Structures"/><category term="CPP Vector"/><category term="CS201 Assignment Solution"/><category term="Ds Malik C++ Programming Chapter-3 Solution(Input/Output)"/><category term="Linked List"/><category term="MathProblems"/><category term="Object Oriented Programming in C++  by Robert Lafore - 4th Edition Chapter 4"/><category term="VU Assignment Solution"/><category term="30 Day C++ Challenge"/><category term="Advantages of C Language"/><category term="Binary Search Tree"/><category term="C++ Puzzles"/><category term="CPP Enum"/><category term="Control Structures"/><category term="Cryptography"/><category term="Disadvantages of C Language"/><category term="Ds malik c++ programming Chapter 2: Basic Elements of C++ Solution"/><category term="Ds malik c++ programming Chapter 4: Control Structures I (Selection) Solution"/><category term="History of C  language"/><category term="Identifiers"/><category term="LinkedList"/><category term="Magic Squares Puzzle without using Recursion"/><category term="OOP Quiz"/><category term="Object Oriented Programming"/><category term="Object Oriented Programming in C++  by Robert Lafore - 4th Edition Chapter 1"/><category term="Recursion"/><category term="Tools of the trade"/><category term="and naming them"/><category term="difference between a keyword and a user-defined identifier"/><category term="fstream"/><category term="ifstream"/><category term="ofstream"/><category term="output"/><title type='text'>C++ Programs, Projects &amp;amp; Examples With Code</title><subtitle type='html'>Find Tons of C++ Programming examples, projects with code. Also find books solutions.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://cppexamples.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default?max-results=3'/><link rel='alternate' type='text/html' href='https://cppexamples.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default?start-index=4&amp;max-results=3'/><author><name>Muhammad Iqbal</name><uri>http://www.blogger.com/profile/08135791859845662739</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>743</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>3</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4032756259402712644.post-8467207176204984657</id><published>2026-03-05T11:46:00.000-08:00</published><updated>2026-03-05T11:46:37.426-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="30 Day C++ Challenge"/><title type='text'>Day 1: Structure of a C++ Program – Learn C++ Programming</title><content type='html'>&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;C++ program structure, C++ tutorial, beginner C++, C++ main function, headers in C++&quot;&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;h1&gt;Day 1: Structure of a C++ Program&lt;/h1&gt;

&lt;p&gt;Welcome to Day 1 of our **C++ programming series**! Today we will learn the **basic structure of a C++ program**, which is essential before writing any C++ code. Understanding this structure helps you organize your code and ensures it compiles correctly.&lt;/p&gt;

&lt;h2&gt;1. Basic Structure&lt;/h2&gt;

&lt;p&gt;A simple C++ program consists of the following parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Headers&lt;/strong&gt;: Libraries included for extra functionality.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Main function&lt;/strong&gt;: The entry point of every C++ program.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Statements&lt;/strong&gt;: Instructions executed in sequence.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Return statement&lt;/strong&gt;: Indicates the program finished successfully.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;2. Example Program&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;  // Include standard input/output library

int main() {
    std::cout &amp;lt;&amp;lt; &quot;Hello, World!&quot; &amp;lt;&amp;lt; std::endl; // Output message
    return 0; // End of program
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;3. Explanation&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;&lt;/code&gt; – Includes the standard library for input/output.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;int main()&lt;/code&gt; – Main function where execution starts.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;std::cout &amp;lt;&amp;lt; &quot;Hello, World!&quot; &amp;lt;&amp;lt; std::endl;&lt;/code&gt; – Prints text to the console.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;return 0;&lt;/code&gt; – Signals successful completion.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;4. Video Tutorial&lt;/h2&gt;
&lt;p&gt;Watch this video to see a detailed explanation and live coding:&lt;/p&gt;
&lt;iframe src=&quot;https://www.youtube.com/embed/-TkoO8Z07hI?start=0&quot; allowfullscreen&gt;&lt;/iframe&gt;

&lt;h2&gt;5. Key Takeaways&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Every C++ program needs a &lt;code&gt;main()&lt;/code&gt; function.&lt;/li&gt;
&lt;li&gt;Include necessary headers to access libraries.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;return 0;&lt;/code&gt; to indicate successful execution.&lt;/li&gt;
&lt;li&gt;Statements inside &lt;code&gt;main()&lt;/code&gt; are executed sequentially.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ &lt;strong&gt;Tip:&lt;/strong&gt; Practice writing multiple small programs to get comfortable with the program structure.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
</content><link rel='replies' type='application/atom+xml' href='https://cppexamples.blogspot.com/feeds/8467207176204984657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment/fullpage/post/4032756259402712644/8467207176204984657?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default/8467207176204984657'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default/8467207176204984657'/><link rel='alternate' type='text/html' href='https://cppexamples.blogspot.com/2026/03/day-1-structure-of-c-program-learn-c.html' title='Day 1: Structure of a C++ Program – Learn C++ Programming'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/-TkoO8Z07hI/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4032756259402712644.post-4209251165687715826</id><published>2018-12-09T14:00:00.002-08:00</published><updated>2018-12-09T14:00:56.329-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Object Oriented Programming"/><title type='text'>CS304 - Object Oriented Programming  Fall 2018 Assignment No. 01 Solution</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
  @page { margin: 0.79in }
  p { margin-bottom: 0.1in; direction: ltr; line-height: 115%; text-align: left; orphans: 2; widows: 2 }
  a:link { color: #0000ff }
 &lt;/style&gt;


&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0.14in; page-break-before: always;&quot;&gt;
 
 
 
 
 &lt;style type=&quot;text/css&quot;&gt;
  @page { margin: 0.79in }
  p { margin-bottom: 0.1in; direction: ltr; color: #000000; line-height: 115%; orphans: 2; widows: 2 }
  p.western { so-language: en-US }
  p.ctl { so-language: ar-SA }
  a:link { color: #0000ff }
 &lt;/style&gt;


&lt;br /&gt;
&lt;div align=&quot;justify&quot; class=&quot;western&quot; style=&quot;line-height: 150%; margin-bottom: 0.11in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;&lt;b&gt;Problem
Statement:&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;western&quot; style=&quot;line-height: 107%; margin-bottom: 0.11in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;We
have the following part of class diagram showing aggregation
relationship:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;western&quot; style=&quot;line-height: 107%; margin-bottom: 0.11in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhivucaCtE7bT_5g6brTjWNAsni9PxGu5b2CbdxUbWwRuXpVPOE7S9p_uf0xYlBUVmJu6ZO66LmLKi_nWqV0z6ZQS4CYYIuMHLnkzuUbTwy51HVk69w1nPwtN90wd17GTYLsWHMe9NSvQo/s1600/sad.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;CS304 - Object Oriented Programming  Fall 2018 Assignment No. 01 Solution&quot; border=&quot;0&quot; data-original-height=&quot;299&quot; data-original-width=&quot;771&quot; height=&quot;155&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhivucaCtE7bT_5g6brTjWNAsni9PxGu5b2CbdxUbWwRuXpVPOE7S9p_uf0xYlBUVmJu6ZO66LmLKi_nWqV0z6ZQS4CYYIuMHLnkzuUbTwy51HVk69w1nPwtN90wd17GTYLsWHMe9NSvQo/s400/sad.png&quot; title=&quot;CS304 - Object Oriented Programming  Fall 2018 Assignment No. 01 Solution&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;western&quot; style=&quot;line-height: 107%; margin-bottom: 0.11in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;western&quot; style=&quot;line-height: 107%; margin-bottom: 0.11in;&quot;&gt;
 
                                  &lt;/div&gt;
&lt;div class=&quot;western&quot; style=&quot;line-height: 107%; margin-bottom: 0.11in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;You
are required to implement above class diagram (complete program) in
C++ with all data members, constructors, member functions and concept
(aggregation) given in the class diagram/table&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;western&quot; style=&quot;line-height: 107%; margin-bottom: 0.11in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;western&quot; style=&quot;line-height: 107%; margin-bottom: 0.11in;&quot;&gt;
 
 
 &lt;style type=&quot;text/css&quot;&gt;
  @page { margin: 0.79in }
  p { margin-bottom: 0.1in; direction: ltr; color: #000000; line-height: 115%; orphans: 2; widows: 2 }
  p.western { font-family: &quot;Calibri&quot;, sans-serif; font-size: 11pt; so-language: en-US }
  p.cjk { font-family: &quot;Calibri&quot;, sans-serif; font-size: 11pt }
  p.ctl { font-family: &quot;Times New Roman&quot;, serif; font-size: 11pt; so-language: ar-SA }
  a:link { color: #0000ff }
 &lt;/style&gt;


&lt;/div&gt;
&lt;table cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;width: 100%px;&quot;&gt;
 &lt;/table&gt;
&lt;br /&gt;

 
 &lt;table cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;width: 100%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;
  &lt;td height=&quot;19&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;b&gt;Class Name&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;b&gt;Functions&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;

   &lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Grocery Home&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; rowspan=&quot;2&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;

   &lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Fruit Store&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td rowspan=&quot;2&quot; style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default constructor&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;

   &lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Grocery Store&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Dairy Store&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Apple&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Grapes&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Guava&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Tetra Milk&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Whitener&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Cream&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Cooking Oil&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;20&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Rice&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;19&quot; style=&quot;border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in; padding-top: 0in;&quot; width=&quot;24%&quot;&gt;
   &lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;Flour&lt;/span&gt;&lt;br /&gt;

  &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding: 0in 0.08in;&quot; width=&quot;76%&quot;&gt;
   &lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;-Default
   constructor&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

   &lt;br /&gt;

  &lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution or &lt;a href=&quot;http://destyy.com/wCbwpM&quot; target=&quot;_blank&quot;&gt;Download.cpp&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;pre class=&quot;ndfHFb-c4YZDc-fmcmS-DARUcf&quot; style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace, arial, sans-serif; font-size: 14px; overflow-wrap: break-word; user-select: text; white-space: pre-wrap;&quot;&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;
class Apple{
 public:
 Apple(){
  cout&amp;lt;&amp;lt;&quot;Apple Constructor called\n&quot;;
 }
};
class Grapes{
 public:
 Grapes(){
  cout&amp;lt;&amp;lt;&quot;Grapes Constructor called\n&quot;;
 }
};
class Guava{
 public:
 Guava(){
  cout&amp;lt;&amp;lt;&quot;Guava Constructor called\n&quot;;
 }
};
class FruitStore{
 Apple a;
 Grapes g;
 Guava gv;
 public:
  FruitStore(){
   cout&amp;lt;&amp;lt;&quot;\nFruit Store Constructor called\n\n&quot;;
   
  }
};
class CookingOil{
 public:
 CookingOil(){
  cout&amp;lt;&amp;lt;&quot;Cooking Oil Constructor called\n&quot;;
 }
}; 
class Rice{
 public:
 Rice(){
  cout&amp;lt;&amp;lt;&quot;Rice Constructor called\n&quot;;
 }
};
class Flour{
 public:
 Flour(){
  cout&amp;lt;&amp;lt;&quot;Flour Constructor called\n&quot;;
 }
};
class GroceryStore{
 CookingOil c;
 Rice r;
 Flour f;
 public:
 GroceryStore(){
 cout&amp;lt;&amp;lt;&quot;\nGrocery Store Constructor called\n\n&quot;;
 
 }
};
class TetraMilk{
 public:
 TetraMilk(){
  cout&amp;lt;&amp;lt;&quot;Tetra Milk Constructor called\n&quot;;
 }
};
class Whitener{
 public:
 Whitener(){
  cout&amp;lt;&amp;lt;&quot;Whitener Constructor called\n&quot;;
 }
};
class Cream{
 public:
 Cream(){
  cout&amp;lt;&amp;lt;&quot;Cream Constructor called\n&quot;;
 }
};
class DairyStore{
 TetraMilk t;
 Whitener w;
 Cream c;
 public:
 DairyStore(){
  cout&amp;lt;&amp;lt;&quot;\nDairy Store Constructor called\n\n&quot;;
  
 }
};
class GroceryHome{
 FruitStore f;
 GroceryStore g;
 DairyStore d;
 public:
  GroceryHome(){
   cout&amp;lt;&amp;lt;&quot;Grocery Home Constructor called\n\n&quot;;
  }
};

main(){
 GroceryHome g;
 
}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://cppexamples.blogspot.com/feeds/4209251165687715826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment/fullpage/post/4032756259402712644/4209251165687715826?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default/4209251165687715826'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default/4209251165687715826'/><link rel='alternate' type='text/html' href='https://cppexamples.blogspot.com/2018/12/cs304-object-oriented-programming-fall-2018-assignment-no-1-solution.html' title='CS304 - Object Oriented Programming  Fall 2018 Assignment No. 01 Solution'/><author><name>Muhammad Iqbal</name><uri>http://www.blogger.com/profile/08135791859845662739</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhivucaCtE7bT_5g6brTjWNAsni9PxGu5b2CbdxUbWwRuXpVPOE7S9p_uf0xYlBUVmJu6ZO66LmLKi_nWqV0z6ZQS4CYYIuMHLnkzuUbTwy51HVk69w1nPwtN90wd17GTYLsWHMe9NSvQo/s72-c/sad.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4032756259402712644.post-7932936764339162434</id><published>2018-12-09T13:38:00.000-08:00</published><updated>2018-12-09T13:38:31.084-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Binary Search Tree"/><title type='text'>CS301 Assignment No 01 Solution Fall 2018</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
  @page { margin: 0.79in }
  p { margin-bottom: 0.1in; direction: ltr; line-height: 115%; text-align: left; orphans: 2; widows: 2 }
  a:link { color: #0000ff }
 &lt;/style&gt;


&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0.14in; page-break-before: always;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Binary
Search tree is the most efficient data structure for solving
different problems. Construction of BST (Binary Search Tree) depends
on the order in which data is inserted into the tree. For building a
Binary Search Tree, data should be inserted into a tree in a way that
nodes with smaller data values appears on left side and larger node
values appears on right side of the root node.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Write
a menu based system program in C++ that will allow you to:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;width: 664px;&quot;&gt;
 &lt;colgroup&gt;&lt;col width=&quot;422&quot;&gt;&lt;/col&gt;
 &lt;col width=&quot;212&quot;&gt;&lt;/col&gt;
 &lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;11&quot; style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;422&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Enter
   Employee data in BST&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;212&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;buildBST()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;14&quot; style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;422&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Post
   order traversal of all the Employee data&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;212&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;postOrder()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td height=&quot;11&quot; style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;422&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Show
   data in ascending order&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;212&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;asscendingOrder()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Take
the following attributes of an Employee from the user:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;empId,
empNname, empSalary&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;You
have to implement the above scenario using BST on the basis of
Employee Id. i.e. if the Id of the Employee is lesser than the root
node then enter the next Employee data in the left child otherwise in
right child. &lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;Note&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;BST
 will implement using Linked List. &lt;/span&gt;&lt;/span&gt;
 &lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Program
 will not allow entering duplicate employee id.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Design
 the program in a way that the user will be able to enter maximum 10
 records.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Take
 empId, empName, empSalary from the user. At least 4 students record
 should be already entered (hard coded records). &lt;/span&gt;&lt;/span&gt;
 &lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;You
will use following already entered Employees data (hard coded
records). &lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;table cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;width: 623px;&quot;&gt;
 &lt;colgroup&gt;&lt;col width=&quot;193&quot;&gt;&lt;/col&gt;
 &lt;col width=&quot;194&quot;&gt;&lt;/col&gt;
 &lt;col width=&quot;193&quot;&gt;&lt;/col&gt;
 &lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Emp
   Id&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;194&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;EmpSalary&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;32&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;194&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Raza&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;3000&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;56&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;194&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Sajjad&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;25000&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;93&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;194&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Rabia&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;19230&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;5&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;194&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Sehar
   &lt;/span&gt;&lt;/span&gt;
   &lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;24000&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;194&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Ali&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td style=&quot;border: 1px solid #000000; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in; padding-top: 0in;&quot; width=&quot;193&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;22200&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;margin-bottom: 0.14in; margin-left: 0.5in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Solution
Guidelines:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;You
 will use&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;
 buildBST() &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;method
 to build Binary Search Tree from the above given data.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Use
 the &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;ascendingOredr()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
 method to show the output in ascending order. With respect to &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;empId&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Use
 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;postOrder()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
 method to traverse the records in post-order.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Sample
output 1:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkQckAsoxT2yFjDH8QN11GtOHTbFbrmftBfeQ20JqjLqPE1H32Eml0EV13DtTTvCm9qOdltVL4XoIA1ec-PqM2jTs6YG0EHlkdLh50iHDJQ04kta3mqHjW6hvpbrh73cIBF3WTqNtFYdw/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;625&quot; data-original-width=&quot;670&quot; height=&quot;298&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkQckAsoxT2yFjDH8QN11GtOHTbFbrmftBfeQ20JqjLqPE1H32Eml0EV13DtTTvCm9qOdltVL4XoIA1ec-PqM2jTs6YG0EHlkdLh50iHDJQ04kta3mqHjW6hvpbrh73cIBF3WTqNtFYdw/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Solution:&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://destyy.com/wCb0X9&quot;&gt;Download.cpp&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.14in; page-break-before: always;&quot;&gt;
#include&amp;lt;iostream&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;string&amp;gt;&lt;br /&gt;
#include&amp;lt;cstring&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
struct Node&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; int empId;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; char* empName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; double empSalary;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Node* left;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Node* right;&lt;br /&gt;
};&lt;br /&gt;
Node* buildBST(Node* root, int i,int id, char* name, double salary)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(root== NULL)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Node* newNode = new Node();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; newNode-&amp;gt;empId = id;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; newNode-&amp;gt;empName = name;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; newNode-&amp;gt;empSalary = salary;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; newNode-&amp;gt;left = newNode-&amp;gt;right = NULL;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return newNode;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(root-&amp;gt;empId == id)&amp;nbsp; // if the element already exists dont need to enter it again...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return root;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else if(id &amp;lt;= root-&amp;gt;empId)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; root-&amp;gt;left = buildBST(root-&amp;gt;left, i, id, name, salary);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; root-&amp;gt;right = buildBST(root-&amp;gt;right, i, id, name, salary);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
void ascendingOrder(Node* root)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(root==NULL)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ascendingOrder(root-&amp;gt;left);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;root-&amp;gt;empId&amp;lt;&amp;lt;&quot;\t&quot;&amp;lt;&amp;lt;root-&amp;gt;empName&amp;lt;&amp;lt;&quot;\t&quot;&amp;lt;&amp;lt;root-&amp;gt;empSalary&amp;lt;&amp;lt;endl;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ascendingOrder(root-&amp;gt;right);&lt;br /&gt;
}&lt;br /&gt;
void postOrder(Node* root)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(root==NULL)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; postOrder(root-&amp;gt;left);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; postOrder(root-&amp;gt;right);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;root-&amp;gt;empId&amp;lt;&amp;lt;&quot;\t&quot;&amp;lt;&amp;lt;root-&amp;gt;empName&amp;lt;&amp;lt;&quot;\t&quot;&amp;lt;&amp;lt;root-&amp;gt;empSalary&amp;lt;&amp;lt;endl;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; int id[]= {32,56,93,5,10};&lt;br /&gt;
&amp;nbsp; &amp;nbsp; char* name[]= {&quot;Raza&quot;,&quot;Sajid&quot;,&quot;Rabia&quot;,&quot;Sehar&quot;,&quot;Ali&quot;};&lt;br /&gt;
&amp;nbsp; &amp;nbsp; double salary[]= {3000, 25000, 19230, 24000, 22200};&lt;br /&gt;
&amp;nbsp; &amp;nbsp; int c;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; int x = (sizeof(id)/sizeof(*id)); // getting the elements of the array, in that case &#39;5&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Node* root = NULL;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; char string[20]; //&amp;nbsp; for new entry a temporary array for getting name....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// loop for entering of the given table in the tree...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for(int i=0; i&amp;lt;x; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; root = buildBST(root, i, id[i], name[i], salary[i]);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// conditions...&lt;br /&gt;
s:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;&quot;Press 1 to Enter Data \n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;Press 2 to see the Records in Ascending Order \n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;Press 3 to see the Records in Post Order \n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;Press 4 to Exit\n &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;c;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; switch(c)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; case 1:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
r:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;&quot;Enter Employee ID : &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;id[x];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;&quot;Enter Employee Salary : &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;salary[x];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;&quot;Enter Employee Name : &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;string;&lt;br /&gt;
// checking redundancy (duplication) for ID...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0; i&amp;lt;x; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(id[x] == id[i])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;&quot;Record Already Exists...&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto r;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
// assigning name a dynamic memory....&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name[x] = new char[strlen(string)+1];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; strcpy(name[x], string);&lt;br /&gt;
&lt;br /&gt;
// again update the tree...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0; i&amp;lt;(x+1); i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; root = buildBST(root, i, id[i], name[i], salary[i]);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; case 2:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;Ascending Order: \n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ascendingOrder(root);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; case 3:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;Post Order: \n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; postOrder(root);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; case 4:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; default:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;\nWrong Input.&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; char ch;&lt;br /&gt;
y:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;&quot;DO YOU WANT TO DO SOMETHING ELSE...\nYES = y \t NO = n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ch = getch();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(ch==&#39;y&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto s;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else if(ch==&#39;n&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;\nBye!&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl&amp;lt;&amp;lt;&quot;\nWrong input.&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://cppexamples.blogspot.com/feeds/7932936764339162434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment/fullpage/post/4032756259402712644/7932936764339162434?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default/7932936764339162434'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4032756259402712644/posts/default/7932936764339162434'/><link rel='alternate' type='text/html' href='https://cppexamples.blogspot.com/2018/12/cs301-assignment-no-01-solution-fall-2018-vu-assignment.html' title='CS301 Assignment No 01 Solution Fall 2018'/><author><name>Muhammad Iqbal</name><uri>http://www.blogger.com/profile/08135791859845662739</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkQckAsoxT2yFjDH8QN11GtOHTbFbrmftBfeQ20JqjLqPE1H32Eml0EV13DtTTvCm9qOdltVL4XoIA1ec-PqM2jTs6YG0EHlkdLh50iHDJQ04kta3mqHjW6hvpbrh73cIBF3WTqNtFYdw/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>