0% found this document useful (0 votes)
41 views2 pages

Cs201p Assignmnt 1 Sol Spring 2022

This C++ program contains functions to calculate the results of three equations given input values, display the results, and determine which result is the maximum. The main function calls calculateEquationResult twice to solve the equations for two sets of inputs. CalculateEquationResult contains the equations and calls maxResult to determine the largest result. MaxResult compares the results and prints a statement about which is greatest.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views2 pages

Cs201p Assignmnt 1 Sol Spring 2022

This C++ program contains functions to calculate the results of three equations given input values, display the results, and determine which result is the maximum. The main function calls calculateEquationResult twice to solve the equations for two sets of inputs. CalculateEquationResult contains the equations and calls maxResult to determine the largest result. MaxResult compares the results and prints a statement about which is greatest.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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