0% found this document useful (0 votes)
36 views4 pages

Software Testing

The document describes an experiment to check the roots of a quadratic equation using boundary value analysis. It defines a function to check if the discriminant is greater than or equal to 0, indicating valid real roots. The main function then calls the boundary analysis, testing values between 1 and 100 for parameters a, b, and c, and prints the results.

Uploaded by

nishantgoelmsit
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views4 pages

Software Testing

The document describes an experiment to check the roots of a quadratic equation using boundary value analysis. It defines a function to check if the discriminant is greater than or equal to 0, indicating valid real roots. The main function then calls the boundary analysis, testing values between 1 and 100 for parameters a, b, and c, and prints the results.

Uploaded by

nishantgoelmsit
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT -1

AIM : To check the roots of quadratic equation using BOUNDARY VALUE analysis.
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<process.h>
void fun(int a, int b,int c)
{ int d=pow(b,2)-(4*a*c);
if(d>0||d==0)
cout<<"valid case"<<endl;
else
cout<<"invalid case"<<endl;}
void boundary(int min,int max)
{int nom=(min+max)/2;
int next_min=min+1;
int next_max=max-1;
cout<<"result of boundary value analysis are:-"<<endl;
cout<<"a=1,b=50,c=50\t";
fun(min,nom,nom);
cout<<"a=50,b=50,c=1\t";
fun(nom,nom,min);
cout<<"a=50,b=1,c=50\t";
fun(nom,min,nom);
cout<<"a=2,b=50,c=50\t";
fun(next_min,nom,nom);
cout<<"a=50,b=50,c=2\t";

fun(nom,nom,next_min);
cout<<"a=50,b=2,c=50\t";
fun(nom,next_min,nom);
cout<<"a=99,b=50,c=50\t";
fun(next_max,nom,nom);
cout<<"a=50,b=50,c=99\t";
fun(nom,nom,next_max);
cout<<"a=50,b=99,c=50\t";
fun(nom,next_max,nom);
cout<<"a=100,b=50,c=50\t";
fun(max,nom,nom);
cout<<"a=50,b=50,c=100\t";
fun(nom,nom,max);
cout<<"a=50,b=100,c=50\t";
fun(nom,max,nom);
cout<<"a=50,b=50,c=50\t";
fun(nom,nom,nom);
}
void main()
{
clrscr();
boundary(1,100);
getch();
}

OUTPUT
a=0;b=50;c=50 valid case

real roots

a=1;b=50;c=50 valid case

real roots

a=99;b=50;c=50 invalid case imaginary roots


a=100;b=50;c=50 invalid case imaginary roots
a=50,b=0,c=50 invalid case imaginary roots
a=50;b=1;c=50 invalid case imaginary roots
a=50;b=99;c=50 invalid case imaginary roots
a=50;b=100;c=50 valid case

equal roots

a=50;b=50;c=0 valid case

real roots

a=50;b=50;c=1 valid case

real roots

a=50;b=50;c=99 invalid case imaginary roots


a=50;b=50;c=100 invalid case imaginary roots

You might also like