<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Pointers]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich würde gerne in mein selbstgeschriebenen Code &quot;Pointers&quot; einfügen. Könnt Ihr mir sagen wo ich diese am besten einfügen kann.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#include &lt;iomanip&gt;// Allows user to set precision

#include &lt;string&gt;

using namespace std;

struct conversion //Groups conversion information

       {       
        double Dollar;

        double rate;

	    string totalCalc;

        string description;

       } currency[5];

void initVariables();

void displayMenu();

void displayResults();

int main()

    {

      bool hasInputFailed;    

      char cont;

      bool docont = true;

           do

             {     

               //Initialize structures and arrays

               initVariables();

               system(&quot;CLS&quot;);     //clears the screen

               displayMenu();

               displayResults();

               do  //Testing character input

                 {

                  hasInputFailed = false;

                  cout &lt;&lt; &quot;\n\nWould you like to continue? (y/n)\n&quot;;

                  cin &gt;&gt; cont;

                      if ( (tolower(cont) != 'n'&amp;&amp; tolower(cont) != 'y') || cin.fail() )

                         {

                          cin.clear();

                          cin.ignore(100,'\n');

                          cout &lt;&lt; &quot;Invalid response, try again:\n&quot;;

                          hasInputFailed = true;

                         }

                       if (tolower(cont) == 'n')

                          {

                           docont = false;

                          }

                      else

                          {

                           docont = true;

                          }

                 }while ( hasInputFailed == true);

             }

             while (docont == true);

return 0;

    }//End of main

void initVariables()

     {
      currency[0].description = &quot; Euros = 0.762953 &quot;;//Display of International rates to a US Dollar
	  currency[0].rate = 0.762953;                   //From http://www.xe.com/ucc/full.shtml
      currency[0].totalCalc = &quot;Euros&quot;; //For total calculation display
	  currency[0].Dollar = 0.0;

      currency[1].description = &quot; Swiss Francs = 1.17806 &quot;;
	  currency[1].rate = 1.17806;
      currency[1].totalCalc = &quot;Swiss Francs&quot;;
	  currency[1].Dollar = 0.0;

      currency[2].description = &quot; British Pounds = 0.534387 &quot;;
	  currency[2].rate = 0.534387;
      currency[2].totalCalc = &quot;British Pounds&quot;;
	  currency[2].Dollar = 0.0;

	  currency[3].description = &quot; Japanese Yens = 101.882 &quot;;
	  currency[3].rate = 101.882;
      currency[3].totalCalc = &quot;Japanese Yens&quot;;
	  currency[3].Dollar = 0.0;

      currency[4].description = &quot; Russian Rubles = 27.9400 &quot;;
	  currency[4].rate = 27.9400;
      currency[4].totalCalc = &quot;Russian Rubles&quot;;
	  currency[4].Dollar = 0.0;
     }

void displayMenu()

     {

      int question;

      double amount;

      bool alreadySelected;

      bool currencySelected[5]; //Keeps track of selections

           for (int i=0; i &lt; 5; i++)

               {

                currencySelected[i] = false;

               }

               do

                 {

                  system(&quot;CLS&quot;); //clears the screen

                               /* Title of Program */

				  cout &lt;&lt; &quot;\t\t***************************\n&quot;;

				  cout &lt;&lt; &quot;\t\tCurrency Conversion Program\n&quot;;

				  cout &lt;&lt; &quot;\t\t***************************\n\n&quot;;

				  cout &lt;&lt; &quot; International rates to 1 US Dollar as of January 17, 2005\n\n&quot;;

				  cout &lt;&lt; &quot;Please choose a foreign currency (1-5)&quot; &lt;&lt; endl;//Prompt user for selection

				  cout &lt;&lt; &quot;or press 0 when done or wishing to exit:&quot; &lt;&lt; endl &lt;&lt; endl;

                  for (int i=0; i &lt; 5; i++)

                      {

                       cout &lt;&lt; &quot;\t&quot; &lt;&lt; i+1 &lt;&lt; &quot;. &quot; &lt;&lt; currency[i].description &lt;&lt; endl;

                      }

                  cout &lt;&lt; &quot;\t0.  Done/Exit&quot; &lt;&lt; endl;

                  cin &gt;&gt; question; //Reads user's input

                  //check for errors

                      if (cin.fail() || question &lt; 0 || question &gt; 5)

                         {

                          cin.clear();//Reseting input to allow new input

                          cin.ignore(100,'\n');//Removes bad data up to 100 characters

                          cout &lt;&lt; &quot;\nYou entered an invalid selection, please try again.&quot; &lt;&lt; endl;

                          continue; //back to the beginning of the loop

                         }

                     else if (question == 0)

                             {

                              break;

                             }

            //check if currency has been already selected, if not select it

              alreadySelected = false;

                     for (i=0; i &lt; 5; i++)

                         {

                          if (question - 1 == i)

                              {

                             if ( currencySelected[i] ) // if it was already selected

                                {

                                 cout &lt;&lt; &quot;\nThis type of currency has been selected already&quot; &lt;&lt; endl;

                                 alreadySelected = true;

                                }

                            else //was not selected before

                                {

                                 currencySelected[i] = true;

                                }

                              }

                         }

                     if (alreadySelected == true)

                        {

                         continue;

                        }

                        //Prompt user for Dollar amount(s)

			        cout &lt;&lt; &quot;\n\t\tPlease enter amount of US Dollars to convert:&quot; &lt;&lt; endl;

                    cin &gt;&gt; amount;//Reads user's input
                  //check for errors

                       while ( cin.fail() || amount &lt;= 0.0 )

                             {

                              cin.clear();//Reseting input to allow new input

                              cin.ignore(100,'\n');//Removes bad data up to 100 characters

                              cout &lt;&lt; &quot;Your entry is invalid, please try again:&quot; &lt;&lt; endl;

                              cin &gt;&gt; amount;

                             }

                      //Setting the structure

                    currency[question - 1].Dollar = amount;

                 } 

			   while (question != 0);
     }

void displayResults() //Displaying results for each currency and amount entered            

     {

      for (int i=0; i &lt; 5; i++)

          {

            if(currency[i].Dollar &gt; 0.0)

              {
                cout &lt;&lt; setprecision(2) &lt;&lt; fixed;

				cout &lt;&lt; &quot;\n\t&quot; &lt;&lt; currency[i].Dollar &lt;&lt; &quot; Dollars will buy &quot; 

                     &lt;&lt; currency[i].rate*currency[i].Dollar &lt;&lt; &quot; &quot; &lt;&lt;  currency[i].totalCalc &lt;&lt;&quot;\n&quot;;

              }

          }

     }
</code></pre>
<p>Vielen Dank im vor raus<br />
xHITMANx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/208876/pointers</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 01:56:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/208876.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Mar 2008 21:23:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pointers on Sun, 23 Mar 2008 21:23:34 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich würde gerne in mein selbstgeschriebenen Code &quot;Pointers&quot; einfügen. Könnt Ihr mir sagen wo ich diese am besten einfügen kann.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#include &lt;iomanip&gt;// Allows user to set precision

#include &lt;string&gt;

using namespace std;

struct conversion //Groups conversion information

       {       
        double Dollar;

        double rate;

	    string totalCalc;

        string description;

       } currency[5];

void initVariables();

void displayMenu();

void displayResults();

int main()

    {

      bool hasInputFailed;    

      char cont;

      bool docont = true;

           do

             {     

               //Initialize structures and arrays

               initVariables();

               system(&quot;CLS&quot;);     //clears the screen

               displayMenu();

               displayResults();

               do  //Testing character input

                 {

                  hasInputFailed = false;

                  cout &lt;&lt; &quot;\n\nWould you like to continue? (y/n)\n&quot;;

                  cin &gt;&gt; cont;

                      if ( (tolower(cont) != 'n'&amp;&amp; tolower(cont) != 'y') || cin.fail() )

                         {

                          cin.clear();

                          cin.ignore(100,'\n');

                          cout &lt;&lt; &quot;Invalid response, try again:\n&quot;;

                          hasInputFailed = true;

                         }

                       if (tolower(cont) == 'n')

                          {

                           docont = false;

                          }

                      else

                          {

                           docont = true;

                          }

                 }while ( hasInputFailed == true);

             }

             while (docont == true);

return 0;

    }//End of main

void initVariables()

     {
      currency[0].description = &quot; Euros = 0.762953 &quot;;//Display of International rates to a US Dollar
	  currency[0].rate = 0.762953;                   //From http://www.xe.com/ucc/full.shtml
      currency[0].totalCalc = &quot;Euros&quot;; //For total calculation display
	  currency[0].Dollar = 0.0;

      currency[1].description = &quot; Swiss Francs = 1.17806 &quot;;
	  currency[1].rate = 1.17806;
      currency[1].totalCalc = &quot;Swiss Francs&quot;;
	  currency[1].Dollar = 0.0;

      currency[2].description = &quot; British Pounds = 0.534387 &quot;;
	  currency[2].rate = 0.534387;
      currency[2].totalCalc = &quot;British Pounds&quot;;
	  currency[2].Dollar = 0.0;

	  currency[3].description = &quot; Japanese Yens = 101.882 &quot;;
	  currency[3].rate = 101.882;
      currency[3].totalCalc = &quot;Japanese Yens&quot;;
	  currency[3].Dollar = 0.0;

      currency[4].description = &quot; Russian Rubles = 27.9400 &quot;;
	  currency[4].rate = 27.9400;
      currency[4].totalCalc = &quot;Russian Rubles&quot;;
	  currency[4].Dollar = 0.0;
     }

void displayMenu()

     {

      int question;

      double amount;

      bool alreadySelected;

      bool currencySelected[5]; //Keeps track of selections

           for (int i=0; i &lt; 5; i++)

               {

                currencySelected[i] = false;

               }

               do

                 {

                  system(&quot;CLS&quot;); //clears the screen

                               /* Title of Program */

				  cout &lt;&lt; &quot;\t\t***************************\n&quot;;

				  cout &lt;&lt; &quot;\t\tCurrency Conversion Program\n&quot;;

				  cout &lt;&lt; &quot;\t\t***************************\n\n&quot;;

				  cout &lt;&lt; &quot; International rates to 1 US Dollar as of January 17, 2005\n\n&quot;;

				  cout &lt;&lt; &quot;Please choose a foreign currency (1-5)&quot; &lt;&lt; endl;//Prompt user for selection

				  cout &lt;&lt; &quot;or press 0 when done or wishing to exit:&quot; &lt;&lt; endl &lt;&lt; endl;

                  for (int i=0; i &lt; 5; i++)

                      {

                       cout &lt;&lt; &quot;\t&quot; &lt;&lt; i+1 &lt;&lt; &quot;. &quot; &lt;&lt; currency[i].description &lt;&lt; endl;

                      }

                  cout &lt;&lt; &quot;\t0.  Done/Exit&quot; &lt;&lt; endl;

                  cin &gt;&gt; question; //Reads user's input

                  //check for errors

                      if (cin.fail() || question &lt; 0 || question &gt; 5)

                         {

                          cin.clear();//Reseting input to allow new input

                          cin.ignore(100,'\n');//Removes bad data up to 100 characters

                          cout &lt;&lt; &quot;\nYou entered an invalid selection, please try again.&quot; &lt;&lt; endl;

                          continue; //back to the beginning of the loop

                         }

                     else if (question == 0)

                             {

                              break;

                             }

            //check if currency has been already selected, if not select it

              alreadySelected = false;

                     for (i=0; i &lt; 5; i++)

                         {

                          if (question - 1 == i)

                              {

                             if ( currencySelected[i] ) // if it was already selected

                                {

                                 cout &lt;&lt; &quot;\nThis type of currency has been selected already&quot; &lt;&lt; endl;

                                 alreadySelected = true;

                                }

                            else //was not selected before

                                {

                                 currencySelected[i] = true;

                                }

                              }

                         }

                     if (alreadySelected == true)

                        {

                         continue;

                        }

                        //Prompt user for Dollar amount(s)

			        cout &lt;&lt; &quot;\n\t\tPlease enter amount of US Dollars to convert:&quot; &lt;&lt; endl;

                    cin &gt;&gt; amount;//Reads user's input
                  //check for errors

                       while ( cin.fail() || amount &lt;= 0.0 )

                             {

                              cin.clear();//Reseting input to allow new input

                              cin.ignore(100,'\n');//Removes bad data up to 100 characters

                              cout &lt;&lt; &quot;Your entry is invalid, please try again:&quot; &lt;&lt; endl;

                              cin &gt;&gt; amount;

                             }

                      //Setting the structure

                    currency[question - 1].Dollar = amount;

                 } 

			   while (question != 0);
     }

void displayResults() //Displaying results for each currency and amount entered            

     {

      for (int i=0; i &lt; 5; i++)

          {

            if(currency[i].Dollar &gt; 0.0)

              {
                cout &lt;&lt; setprecision(2) &lt;&lt; fixed;

				cout &lt;&lt; &quot;\n\t&quot; &lt;&lt; currency[i].Dollar &lt;&lt; &quot; Dollars will buy &quot; 

                     &lt;&lt; currency[i].rate*currency[i].Dollar &lt;&lt; &quot; &quot; &lt;&lt;  currency[i].totalCalc &lt;&lt;&quot;\n&quot;;

              }

          }

     }
</code></pre>
<p>Vielen Dank im vor raus<br />
xHITMANx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1479353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1479353</guid><dc:creator><![CDATA[xHITMANxx]]></dc:creator><pubDate>Sun, 23 Mar 2008 21:23:34 GMT</pubDate></item><item><title><![CDATA[Reply to Pointers on Sun, 23 Mar 2008 21:54:36 GMT]]></title><description><![CDATA[<p>Du weisst schon, was pointer (zeiger) sind, oder?</p>
<pre><code class="language-cpp">int i = 2;

int* pi = &amp;i; //Der Zeiger pi zeig auf einen Integer (hier i)
</code></pre>
<p>Du solltest dir das noch mal überlegen und dann kannst du selber entscheiden, wann du einen Zeiger brauchst und wann nicht.</p>
<p>btw:<br />
Man schreibt voraus nur mit einem 'r' und zusammen..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1479364</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1479364</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 23 Mar 2008 21:54:36 GMT</pubDate></item></channel></rss>