<?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[C++ Probleme]]></title><description><![CDATA[<p>Kann mir bitte jemand sagen, wo mein Fehler steckt (oder stecken)? Ich versuche dieses Programm von Java in C++ umzuschreiben.<br />
Das habe ich bisher geschrieben</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

    int main(int argc, char *argv[])
{       int kcal,eiweiss,fett;
        int gesamtkcal = 0,gesamteiweiss = 0,gesamtfett = 0, count = 0;
        char rueckgaengig, antwort;

        cout&lt;&lt; &quot;Wollen Sie scannen? Verneinung mit n\n&quot;;
        cin&gt;&gt;antwort;

        while ( !&quot;n&quot;==antwort )       
        {
            cout&lt;&lt; &quot;QR Code scannen\n&quot;;
            cin&gt;&gt;kcal;
            cin&gt;&gt;eiweiss;
            cin&gt;&gt;fett;

            cout&lt;&lt; &quot;Für rueckgaengig, bitte ´r´ eingeben\n&quot;;
            cin&gt;&gt;rueckgaengig;

                    if (!rueckgaengig==r)

                        gesamtkcal    = kcal    + gesamtkcal;
                        gesamteiweiss = eiweiss + gesamteiweiss;
                        gesamtfett    = fett    + gesamtfett;

                        cout&lt;&lt; &quot;Energiegehalt\t&quot; &lt;&lt; gesamtkcal &lt;&lt; &quot;kcal\n&quot;;
                        cout&lt;&lt; &quot;Gesamteiweiss\t&quot; &lt;&lt; gesamteiweiss &lt;&lt; &quot;g\n&quot;;
                        cout&lt;&lt; &quot;Gesamtfett\t&quot; &lt;&lt; gesamtfett &lt;&lt; &quot;g\n&quot;;
                        ++count;}

					else   
                       {cout&lt;&lt; &quot;Wird nicht addiert\n&quot;;
                       }
				    cout&lt;&lt; &quot;Wollen Sie scannen? Verneinung mit n\n&quot;;
                    cin&gt;&gt;antwort;

        }
        ++count; //er fängt doch bei null zu zählen an?              

		cout&lt;&lt; &quot;Sie haben &quot;&lt;&lt;count &lt;&lt; &quot; Produkte gekauft\n&quot;;
        cout&lt;&lt; &quot;Energiegehalt\t&quot; &lt;&lt; gesamtkcal &lt;&lt; &quot;kcal\n&quot;;
        cout&lt;&lt; &quot;Gesamteiweiss\t&quot; &lt;&lt; gesamteiweiss &lt;&lt; &quot;g\n&quot;;
        cout&lt;&lt; &quot;Gesamtfett\t&quot; &lt;&lt; gesamtfett &lt;&lt; &quot;g\n&quot;;
        }
</code></pre>
<p>und so sah das ganze in java aus, (damit ihr wisst, was ich eigentlich machen wollte) <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="😉"
    /></p>
<pre><code class="language-java">import java.io.*;

class versuch
{
  public static void main (String[] args ) throws IOException
  {

	BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
	String inputData;
	int kcal,eiweiss,fett;
	int gesamtkcal = 0,gesamteiweiss = 0,gesamtfett = 0, count = 0;	

    System.out.println( &quot;Wollen Sie scannen? Verneinung mit n&quot;);
	inputData = stdin.readLine();

    while ( !inputData.equals(&quot;n&quot;)) //soll nur einlesen, wenn input nicht n ist
    {     
    	System.out.println( &quot;QR Code scannen&quot;);
        kcal     = Integer.parseInt( stdin.readLine() );
        eiweiss  = Integer.parseInt( stdin.readLine() );
        fett     = Integer.parseInt( stdin.readLine() );

    	   System.out.println( &quot;Für rückgängig, bitte ´r´ eingeben&quot;); //falls man sich verdippt oder gar nicht kauft
    	    inputData = stdin.readLine();

    	if ( !inputData.equals(&quot;r&quot;)) //nur addieren, wenn nicht r eingegeben wird
        {System.out.println( &quot;Produktwerte addiert&quot;);
    	gesamtkcal    = kcal    + gesamtkcal;
    	gesamteiweiss = eiweiss + gesamteiweiss;
    	gesamtfett    = fett    + gesamtfett;

    	System.out.println( &quot;Energiegehalt&quot;+ &quot;\t&quot; + gesamtkcal + &quot; kcal&quot;);
    	System.out.println( &quot;Gesamteiweiss&quot;+ &quot;\t&quot; + gesamteiweiss + &quot; g&quot;);	
    	System.out.println( &quot;Gesamtfett&quot;+ &quot;\t&quot; + gesamtfett +&quot; g&quot;);

    	count++;
    	}

    	else
        {System.out.println( &quot;Wird nicht addiert&quot;);
    	}

        System.out.println( &quot;Wollen Sie scannen? Verneinung mit n&quot;);
    	inputData = stdin.readLine();

    }
	System.out.println( &quot;Sie haben &quot;+ count + &quot; Produkte gekauft&quot;);
	System.out.println( &quot;Energiegehalt&quot;+ &quot;\t&quot; + gesamtkcal + &quot; kcal&quot;);
	System.out.println( &quot;Gesamteiweiss&quot;+ &quot;\t&quot; + gesamteiweiss + &quot; g&quot;);	
	System.out.println( &quot;Gesamtfett&quot;+ &quot;\t&quot; + gesamtfett +&quot; g&quot;);

}}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/239546/c-probleme</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 12:20:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/239546.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 24 Apr 2009 17:19:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Probleme on Fri, 24 Apr 2009 17:19:48 GMT]]></title><description><![CDATA[<p>Kann mir bitte jemand sagen, wo mein Fehler steckt (oder stecken)? Ich versuche dieses Programm von Java in C++ umzuschreiben.<br />
Das habe ich bisher geschrieben</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

    int main(int argc, char *argv[])
{       int kcal,eiweiss,fett;
        int gesamtkcal = 0,gesamteiweiss = 0,gesamtfett = 0, count = 0;
        char rueckgaengig, antwort;

        cout&lt;&lt; &quot;Wollen Sie scannen? Verneinung mit n\n&quot;;
        cin&gt;&gt;antwort;

        while ( !&quot;n&quot;==antwort )       
        {
            cout&lt;&lt; &quot;QR Code scannen\n&quot;;
            cin&gt;&gt;kcal;
            cin&gt;&gt;eiweiss;
            cin&gt;&gt;fett;

            cout&lt;&lt; &quot;Für rueckgaengig, bitte ´r´ eingeben\n&quot;;
            cin&gt;&gt;rueckgaengig;

                    if (!rueckgaengig==r)

                        gesamtkcal    = kcal    + gesamtkcal;
                        gesamteiweiss = eiweiss + gesamteiweiss;
                        gesamtfett    = fett    + gesamtfett;

                        cout&lt;&lt; &quot;Energiegehalt\t&quot; &lt;&lt; gesamtkcal &lt;&lt; &quot;kcal\n&quot;;
                        cout&lt;&lt; &quot;Gesamteiweiss\t&quot; &lt;&lt; gesamteiweiss &lt;&lt; &quot;g\n&quot;;
                        cout&lt;&lt; &quot;Gesamtfett\t&quot; &lt;&lt; gesamtfett &lt;&lt; &quot;g\n&quot;;
                        ++count;}

					else   
                       {cout&lt;&lt; &quot;Wird nicht addiert\n&quot;;
                       }
				    cout&lt;&lt; &quot;Wollen Sie scannen? Verneinung mit n\n&quot;;
                    cin&gt;&gt;antwort;

        }
        ++count; //er fängt doch bei null zu zählen an?              

		cout&lt;&lt; &quot;Sie haben &quot;&lt;&lt;count &lt;&lt; &quot; Produkte gekauft\n&quot;;
        cout&lt;&lt; &quot;Energiegehalt\t&quot; &lt;&lt; gesamtkcal &lt;&lt; &quot;kcal\n&quot;;
        cout&lt;&lt; &quot;Gesamteiweiss\t&quot; &lt;&lt; gesamteiweiss &lt;&lt; &quot;g\n&quot;;
        cout&lt;&lt; &quot;Gesamtfett\t&quot; &lt;&lt; gesamtfett &lt;&lt; &quot;g\n&quot;;
        }
</code></pre>
<p>und so sah das ganze in java aus, (damit ihr wisst, was ich eigentlich machen wollte) <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="😉"
    /></p>
<pre><code class="language-java">import java.io.*;

class versuch
{
  public static void main (String[] args ) throws IOException
  {

	BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
	String inputData;
	int kcal,eiweiss,fett;
	int gesamtkcal = 0,gesamteiweiss = 0,gesamtfett = 0, count = 0;	

    System.out.println( &quot;Wollen Sie scannen? Verneinung mit n&quot;);
	inputData = stdin.readLine();

    while ( !inputData.equals(&quot;n&quot;)) //soll nur einlesen, wenn input nicht n ist
    {     
    	System.out.println( &quot;QR Code scannen&quot;);
        kcal     = Integer.parseInt( stdin.readLine() );
        eiweiss  = Integer.parseInt( stdin.readLine() );
        fett     = Integer.parseInt( stdin.readLine() );

    	   System.out.println( &quot;Für rückgängig, bitte ´r´ eingeben&quot;); //falls man sich verdippt oder gar nicht kauft
    	    inputData = stdin.readLine();

    	if ( !inputData.equals(&quot;r&quot;)) //nur addieren, wenn nicht r eingegeben wird
        {System.out.println( &quot;Produktwerte addiert&quot;);
    	gesamtkcal    = kcal    + gesamtkcal;
    	gesamteiweiss = eiweiss + gesamteiweiss;
    	gesamtfett    = fett    + gesamtfett;

    	System.out.println( &quot;Energiegehalt&quot;+ &quot;\t&quot; + gesamtkcal + &quot; kcal&quot;);
    	System.out.println( &quot;Gesamteiweiss&quot;+ &quot;\t&quot; + gesamteiweiss + &quot; g&quot;);	
    	System.out.println( &quot;Gesamtfett&quot;+ &quot;\t&quot; + gesamtfett +&quot; g&quot;);

    	count++;
    	}

    	else
        {System.out.println( &quot;Wird nicht addiert&quot;);
    	}

        System.out.println( &quot;Wollen Sie scannen? Verneinung mit n&quot;);
    	inputData = stdin.readLine();

    }
	System.out.println( &quot;Sie haben &quot;+ count + &quot; Produkte gekauft&quot;);
	System.out.println( &quot;Energiegehalt&quot;+ &quot;\t&quot; + gesamtkcal + &quot; kcal&quot;);
	System.out.println( &quot;Gesamteiweiss&quot;+ &quot;\t&quot; + gesamteiweiss + &quot; g&quot;);	
	System.out.println( &quot;Gesamtfett&quot;+ &quot;\t&quot; + gesamtfett +&quot; g&quot;);

}}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1700848</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1700848</guid><dc:creator><![CDATA[Anasus]]></dc:creator><pubDate>Fri, 24 Apr 2009 17:19:48 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Probleme on Fri, 24 Apr 2009 17:58:46 GMT]]></title><description><![CDATA[<p>He Alda und was geht jetzt net?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1700863</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1700863</guid><dc:creator><![CDATA[Obachecka]]></dc:creator><pubDate>Fri, 24 Apr 2009 17:58:46 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Probleme on Fri, 24 Apr 2009 19:14:43 GMT]]></title><description><![CDATA[<p>es funktioniert einfach nicht...<br />
mir wird immer gesagt...<br />
fehlermeldung!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1700897</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1700897</guid><dc:creator><![CDATA[Anasus]]></dc:creator><pubDate>Fri, 24 Apr 2009 19:14:43 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Probleme on Fri, 24 Apr 2009 19:18:29 GMT]]></title><description><![CDATA[<p>Hey, sagst du voll konkret welche. Verstehst du, musst du meldung sagen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1700898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1700898</guid><dc:creator><![CDATA[Obachecka]]></dc:creator><pubDate>Fri, 24 Apr 2009 19:18:29 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Probleme on Fri, 24 Apr 2009 19:24:25 GMT]]></title><description><![CDATA[<p>Anasus schrieb:</p>
<blockquote>
<p>es funktioniert einfach nicht...<br />
mir wird immer gesagt...<br />
fehlermeldung!!!</p>
</blockquote>
<p>diese beschreibung ist zu ungenau. als fragesteller mußt du es dem beantworter so leicht wie möglich machen, deine fehler zu finden. dazu gehören mindestens die zeilennummer und der komplette text der ersten fehlermeldung. es ist üblich, daß nur der erste fehler im forum bereinigt wird. falls es weitere fehler gibt, kannst du danach dann weitere fehlermeldungen posten.<br />
ich schließe den thread. du kannst mit einer präziseren frage erneut einsteigen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1700903</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1700903</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 24 Apr 2009 19:24:25 GMT</pubDate></item></channel></rss>