Can't find the error
Go to solution
Solved by Mira Yurizaki,
I added comments:
#pragma endregion private: System::Void btnAction_Click(System::Object^ sender, System::EventArgs^ e) { int iMin = 0, iMax = 0, i =0, iDrapeau = 0; if(txtEntier1->Text != "") { if(txtEntier2->Text != "") { iMin.TryParse(txtEntier1->Text,iMin); iMax.TryParse(txtEntier2->Text,iMax); while(iMin < iMax) { for(i = 2;i <= iMin/2; ++i) { if(iMin % i == 0) { iDrapeau = 1; break; // This only breaks out of the for loop } } if(iDrapeau == 0) { lblNombrePremier->Text += ", " + iMin.ToString(); iMin++; // If iDrapeau is 1, this never gets ran, and so iMin < iMax is always going to be true // And it doesn't appear you have iDrapeau = 0 anywhere else } } } else { MessageBox::Show("Entre un nombre entier maximum valide!"); } } else { MessageBox::Show("Entre un nombre entier minimum valide!"); } }

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now