السلام عليكم ورحمة الله وبركاته
يا شباب أنا عندي خوارزمية جاهزة و أبغى أبرمجها بلغة الــ C++
وبرمجتها ولكن الأستاذ قال لي الكود مش كويس
ممكن تساعودني في تعديل الكود
ربي ينجحكم
وهذي الخوارزمية
Purpose: This is Algorithm, which tests a given program P using a given huge test suite {t1, t2, …, tn} (n is
very large). P can be modified for fault-removal upon the detection of a failure during the testing process.
This algorithm also includes code to monitor the cost-effectiveness of itself in terms of the number of failures
detected and the number of test cases executed.
Precondition: A testing stopping criterion has been given.
Begin Algorithm:
1. Initialize nbOfAllTests and nbOfDetectedFailures to 0.
2. Initialize Set0 to empty.
3. Initialize Set1 to {t1, t2, …, tn}.
4. Initialize currentSet to empty. /* currentSet always contains no more than one element */
5. Randomly select a test case ti from Set1, and move ti from Set1 to currentSet.
6. While (currentSet is not empty and the given testing stopping criterion is not met)
7. Test P using the test case in currentSet.
8. Increase nbOfAllTests by 1.
9. If (no failure is detected)
Then
10. Move the test case in currentSet to Set0.
11. If Set1 is not empty, then randomly select a test case from Set1, and move
it to currentSet.
Else
12. Increase nbOfDetectedFailures by 1.
13. Print nbOfDetectedFailures and nbOfAllTests.
14. An attempt can be made to remove the fault from P.
15. Move all elements in Set0 to Set1. /* The element in currentSet remains there. */
EndIf
16. EndWhile
17. Print nbOfDetectedFailures and nbOfAllTests.
End of Algorithmوهذا الكود اللي سويته
:
#include <iostream.h>
int main()
{
int f=0;
int t=0;
int set0[];
int set1[];
for (int i=1;i<=13551;i++)
{
gcc space.c debugV ??
./a.exe gr ??
t++;
if (gro==grd)??
{
then set0[]=gr;??
else
{
f++;
cout<<f<<"and"<<t<<nl;
remove foult?????
set1[]=set0[];
}
}
}
cout<<f<<"and"<<t<<nl;
return 0;
}ساعدوني ربي يساعدكم