<?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[Run Time Error hilf plz :&#x27;(]]></title><description><![CDATA[<p>ich bekomm ein run time error aber ich weis nicht wiso alles lauft so wie es muss, siht einer was was ich nicht sehe.</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

class Cashier{
      private: 
               bool open_flag, serving_flag;
               int customers_served;
               int L;
      public:
               Cashier(){open_flag=0; serving_flag=0;}
               void set_L(int a){L=a;}
               void open(){
                    cout &lt;&lt; &quot;Cashier now opened!&quot; &lt;&lt; endl;
                    open_flag=1;
                    customers_served=0;}
               void close(){
                    cout &lt;&lt; &quot;Cashier closed!&quot; &lt;&lt; endl;
                    open_flag=0;}
               void serve(){
                    cout &lt;&lt; &quot;Serving customer!&quot; &lt;&lt; endl;
                    serving_flag=1;}
               void free(){
                    cout &lt;&lt; &quot;Customer served, now free!&quot; &lt;&lt; endl;
                    serving_flag=0;
                    if(++customers_served==L) close();}
               bool is_open(){
                    return open_flag;}
               bool is_free(){
                    return serving_flag;}
                    };

class Bank{
      private:
               int customer;
               int serving;
               int K, M, N;
      public:
               int GcashierNm;

               void open(int cashierNm){
                    cashier[cashierNm].open();}

               void close(int cashierNm){
                    cashier[cashierNm].close();}

               int waiting_customers(){return(customer-serving);}

               int open_cashiers(){
                   int counter=0;
                   for(int i=0; i&lt;5; i++){
                         if(cashier[i].is_open()==1)
                                counter++;}
                   return counter;
                   }

               bool check_to_open(){
                   if((customer-serving)&gt;(open_cashiers()*K)) return 1;
                   else return 0;
                   }

               bool check_to_close(){
                   if((customer-serving)&lt;=((open_cashiers()-1)*K)) return 1;
                   else return 0;
                   }

               Cashier cashier[5];

               Bank(int a, int b, int c){
                   K=a;
                   M=b;
                   N=c;     
                   customer=0;
                   serving=1;
                   GcashierNm=0;
                   open(GcashierNm);
                   }

               bool enter(){
                   if(check_to_open()==1) customer++;
                   else if (GcashierNm&lt;5){
                         open(open_cashiers());
                         customer++;}
                         else {
                              cout &lt;&lt; &quot;Sorry you cannot enter until some customers are served!&quot; &lt;&lt; endl;
                              return 0;}
                         } 

               void exit(){
                   int counter=0;
                   customer++;
                   if(check_to_close()==1){
                         for(int i=0; i&lt;5; i++)
                               if(cashier[i].is_open()==1){
                                      close(i);
                                      }
                               }
                   }

               void serve(){
                   int counter=0;
                   for (int i=0; i&lt;5; i++)
                         if(cashier[i].is_open()==0)
                             counter++;
                   open(counter);
                   cout &lt;&lt; &quot;Customer No:&quot; &lt;&lt; serving &lt;&lt; &quot; by cashier No:&quot; &lt;&lt; counter &lt;&lt; endl;
                   cashier[counter].serve();
                   cashier[counter].free();
 //                  exit();
                   }
};

int main(int argc, char *argv[]){
       int counter = 0;
       Bank My_bank(2, 2, 2);
       for(int i=0; i&lt;2; i++){
               for(int j=0; j&lt;2; j++){
                       My_bank.enter();
                       if(My_bank.enter()==false)
						   counter++;
                       My_bank.serve();

               }
       }
       for(int i=0; i&lt;counter; i++){
               My_bank.serve();}
	   return EXIT_SUCCESS;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/141882/run-time-error-hilf-plz</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 16:14:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/141882.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 26 Mar 2006 00:47:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Run Time Error hilf plz :&#x27;( on Sun, 26 Mar 2006 00:47:54 GMT]]></title><description><![CDATA[<p>ich bekomm ein run time error aber ich weis nicht wiso alles lauft so wie es muss, siht einer was was ich nicht sehe.</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

class Cashier{
      private: 
               bool open_flag, serving_flag;
               int customers_served;
               int L;
      public:
               Cashier(){open_flag=0; serving_flag=0;}
               void set_L(int a){L=a;}
               void open(){
                    cout &lt;&lt; &quot;Cashier now opened!&quot; &lt;&lt; endl;
                    open_flag=1;
                    customers_served=0;}
               void close(){
                    cout &lt;&lt; &quot;Cashier closed!&quot; &lt;&lt; endl;
                    open_flag=0;}
               void serve(){
                    cout &lt;&lt; &quot;Serving customer!&quot; &lt;&lt; endl;
                    serving_flag=1;}
               void free(){
                    cout &lt;&lt; &quot;Customer served, now free!&quot; &lt;&lt; endl;
                    serving_flag=0;
                    if(++customers_served==L) close();}
               bool is_open(){
                    return open_flag;}
               bool is_free(){
                    return serving_flag;}
                    };

class Bank{
      private:
               int customer;
               int serving;
               int K, M, N;
      public:
               int GcashierNm;

               void open(int cashierNm){
                    cashier[cashierNm].open();}

               void close(int cashierNm){
                    cashier[cashierNm].close();}

               int waiting_customers(){return(customer-serving);}

               int open_cashiers(){
                   int counter=0;
                   for(int i=0; i&lt;5; i++){
                         if(cashier[i].is_open()==1)
                                counter++;}
                   return counter;
                   }

               bool check_to_open(){
                   if((customer-serving)&gt;(open_cashiers()*K)) return 1;
                   else return 0;
                   }

               bool check_to_close(){
                   if((customer-serving)&lt;=((open_cashiers()-1)*K)) return 1;
                   else return 0;
                   }

               Cashier cashier[5];

               Bank(int a, int b, int c){
                   K=a;
                   M=b;
                   N=c;     
                   customer=0;
                   serving=1;
                   GcashierNm=0;
                   open(GcashierNm);
                   }

               bool enter(){
                   if(check_to_open()==1) customer++;
                   else if (GcashierNm&lt;5){
                         open(open_cashiers());
                         customer++;}
                         else {
                              cout &lt;&lt; &quot;Sorry you cannot enter until some customers are served!&quot; &lt;&lt; endl;
                              return 0;}
                         } 

               void exit(){
                   int counter=0;
                   customer++;
                   if(check_to_close()==1){
                         for(int i=0; i&lt;5; i++)
                               if(cashier[i].is_open()==1){
                                      close(i);
                                      }
                               }
                   }

               void serve(){
                   int counter=0;
                   for (int i=0; i&lt;5; i++)
                         if(cashier[i].is_open()==0)
                             counter++;
                   open(counter);
                   cout &lt;&lt; &quot;Customer No:&quot; &lt;&lt; serving &lt;&lt; &quot; by cashier No:&quot; &lt;&lt; counter &lt;&lt; endl;
                   cashier[counter].serve();
                   cashier[counter].free();
 //                  exit();
                   }
};

int main(int argc, char *argv[]){
       int counter = 0;
       Bank My_bank(2, 2, 2);
       for(int i=0; i&lt;2; i++){
               for(int j=0; j&lt;2; j++){
                       My_bank.enter();
                       if(My_bank.enter()==false)
						   counter++;
                       My_bank.serve();

               }
       }
       for(int i=0; i&lt;counter; i++){
               My_bank.serve();}
	   return EXIT_SUCCESS;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1023974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1023974</guid><dc:creator><![CDATA[Master User]]></dc:creator><pubDate>Sun, 26 Mar 2006 00:47:54 GMT</pubDate></item><item><title><![CDATA[Reply to Run Time Error hilf plz :&#x27;( on Sun, 26 Mar 2006 02:21:05 GMT]]></title><description><![CDATA[<p>benutz den debugger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1023983</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1023983</guid><dc:creator><![CDATA[64a645656]]></dc:creator><pubDate>Sun, 26 Mar 2006 02:21:05 GMT</pubDate></item><item><title><![CDATA[Reply to Run Time Error hilf plz :&#x27;( on Sun, 26 Mar 2006 06:11:17 GMT]]></title><description><![CDATA[<p>Master User schrieb:</p>
<blockquote>
<p>siht einer was was ich nicht sehe.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1023996</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1023996</guid><dc:creator><![CDATA[Antwort schreiben]]></dc:creator><pubDate>Sun, 26 Mar 2006 06:11:17 GMT</pubDate></item><item><title><![CDATA[Reply to Run Time Error hilf plz :&#x27;( on Sun, 26 Mar 2006 07:08:05 GMT]]></title><description><![CDATA[<p>leg ein augenmerk auf dieses</p>
<pre><code>void serve(){
                   int counter=0;
                   for (int i=0; i&lt;5; i++)
                         if(cashier[i].is_open()==0)
                             counter++;
                   open(counter);
                   cout &lt;&lt; &quot;Customer No:&quot; &lt;&lt; serving &lt;&lt; &quot; by cashier No:&quot; &lt;&lt; counter &lt;&lt; endl;
                   cashier[counter].serve();
                   cashier[counter].free();
 //                  exit();
                   }
}
</code></pre>
<p>hier sieht man schon, dass du mal versucht hast, durch extreme methoden auszusteigen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> wieso rekursiv? also wieso der aufruf von serve in serve?</p>
<p>denke, da liegt eine harke, auch wenn ich jetzt mal nicht weiter schaue ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1023999</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1023999</guid><dc:creator><![CDATA[elise]]></dc:creator><pubDate>Sun, 26 Mar 2006 07:08:05 GMT</pubDate></item><item><title><![CDATA[Reply to Run Time Error hilf plz :&#x27;( on Sun, 26 Mar 2006 17:30:48 GMT]]></title><description><![CDATA[<p>danke alles ok jetzt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1024338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1024338</guid><dc:creator><![CDATA[Master User]]></dc:creator><pubDate>Sun, 26 Mar 2006 17:30:48 GMT</pubDate></item></channel></rss>