Cs201p Assignmnt 1 Sol Spring 2022

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

CS201p Assignment 1 Solution Spring 2022

Submit Your Assignment in .cpp format

// Subscribe Youtube Channel VU EXPERT

#include<iostream>
using namespace std;

void calculateEquationResult (float a, float b, float c, float d, float x);

void maxResult (float e1, float ee2, float eee3);

main()

{
char po;
calculateEquationResult (2,3,4,5,10);

do
{

cout<<" \n Do you want to enter more data (Y for Yes N for No): ";
cin>>po;
if(po=='y' || po =='Y')
calculateEquationResult (6,7,8,9,11);
else
break;
}
while (po=='y'|| po=='Y');
}

void calculateEquationResult (float a, float b, float c, float d, float x)


{
float qe1, qe2, qe3;
qe1 = x + b/(3*a);
qe2 = (3*a*c - (b*b)) / (3* (a*a));
qe3 = (2* (b*b*b)-9 * (a+b+c)+27*(a*a)* d) / (27 + (a*a*a));

cout<< "Equation No 1: "<<qe1<<endl;


cout<< "Equation No 2: "<<qe2<<endl;
cout<< "Equation No 3: "<<qe3<<endl;
maxResult (qe1, qe2, qe3);

void maxResult (float qe1, float qe2, float qe3)


{
if (qe1> qe2 && qe1 > qe3)
cout<<"\n Equation 1 Result is Maximum ";
else if (qe2 > qe1 && qe2 > qe3)
cout<<"\n Equation 2 Result is Maximum";
else
cout<<"\n Equation 3 Result is Maximum ";
}

You might also like