LMSWITHHAMZA

VU

cs201p Assignment 1 solution 2022



hello students here we privide solution of cs201p assignment 

please make changes before uploud your file 

file must be uplaod in cpp form.

assignment upload in fix time

PLEASE COPY THIS CODE AND PASTE IN DEV C++

#include <iostream>
#include <conio.h>

using namespace std;

/* run this program using the console pauser or add your own getch, system(“pause”) or input loop */

maxResult (float eq1,float eq2, float eq3 ){
if(eq1 > eq2 && eq1 > eq3){
cout<< “Equation 1: “<< ” “<< eq1 << ” “<<” Result is maximum \n”<<endl;
}

else if(eq2 > eq1 && eq2 > eq3){
cout<< “Equation 2:”<< ” “<< eq2 << ” ” <<” Result is maximum \n”<<endl;

}
else if(eq3 > eq1 && eq3 > eq2){
cout<< “Equation 3:”<< ” “<< eq3 << ” “<<“Result is maximum \n”<<endl;

}
else{

}
}

calculateEquationResult(){
float eq1;
float eq2;
float eq3;
float a;
float b;
float c;
float d;
float x;

int count=0;

while(count<2){
// for counter increase
count++;

if(count == 2){
a=6;
b=7;
c=8;
d=9;
x=11;

}
else{
a=2;
b=3;
c=4;
d=5;
x=10;

}

eq1= x + (b/(3*a));
eq2=(3*a*c-b*b)/(3*a*a);
eq3=(2*b*b*b – 9*(a+b+c)+27*a*a*d)/(27+a*a*a);

//cout<< “For A”<< a<<endl;
//cout<< “For b”<< b<<endl;
//cout<< “For c”<< c<<endl;
//cout<< “For d”<< d<<endl;
//cout<< “For x”<< count<<endl;

cout<< “Equation 1:”<< ” “<< eq1<<endl;
cout<< “Equation 2:”<< ” “<< eq2<<endl;
cout<< “Equation 3:”<< ” “<< eq3<<“\n”<<endl;

maxResult (eq1,eq2,eq3);
}

}

int main() {
char choice;
bool run = true;

while(run)
{

// do while start
do{
calculateEquationResult();
cout<<“Would you like to perform other calculation?(Y/N)”;
cin >> choice;
choice = tolower(choice);//Put your letter to its lower case
}while (choice != ‘n’ && choice != ‘y’);
// do while end

// for choice
if(choice ==’n’){
run = false;
}
}
// for choice end

// Make your calculation

return 0;
}