Wo liegt der Breakpoint



  • Das Programm läuft wenn ich als Obergrenze im 1. for 9 eingebe. darüber sagt es vor Prüfung =1;

    : Thread 1: breakpoint 1.1 und rennt weiter, dann drücke ich stop und es sagt: "Ended with exit code 9"

    Was meint Exit code 9?

    #include <string.h>
    #include <iostream>
    using namespace std;
    #include <sstream>
    #include <string>
    #include <vector>
    #include <cstdio>
    #include <math.h>
    
    int zahl=0; //Zelerlahl
    int uz=0; // zu untersuchende Zahl
    int y; // Probeteiler
    
    int main()
    {
        for (zahl=3;zahl<=9;zahl=zahl+2)
        {
            uz=(zahl*zahl)-2;
    
            int y=0; int pruefung=0;
            for(y=3; y<=sqrt(uz); y=y+2)
            {
                if(uz%y==0)
                  pruefung=1;
            }
    cout<<pruefung<<"=prue   "<<y<<"=y "<<uz%y<<"=mod "<<" ";
    
            if(pruefung==!1)
            {
                //pzzeler.push_back(*it);
                cout<<uz<< " ist PZ!" << endl;
            }
            else
            {
                //npzzeler.push_back(*it);
                cout <<uz<<" keine PZ!" << endl;
            }
            //cout<<"Ende"<<endl;
        }
        std::cout<<zahl<<". "<<zahl*zahl <<" QZ\n";
        return 0;
    }
    


  • Welchen Debugger verwendest du denn?

    Ich denke if(pruefung==!1) macht nicht was du willst, denn !1 == 0 , d.h. diese Abfrage bedeutet if(pruefung == 0) .

    Es sollte wohl if(pruefung != 1) sein ( != ist der Ungleich-Operator).



  • icarus2 schrieb:

    Welchen Debugger verwendest du denn?

    Xcode 8.3.2


Anmelden zum Antworten