Solve the following parts: Part A: Complete the following code segment that read
ID: 3574645 • Letter: S
Question
Solve the following parts:
Part A:
Complete the following code segment that reads in the value of Discriminant and should output a message stating whether the variable represents 2 Complex Roots (less than -10 to the -5 power), 2 Real Roots (greater than 10 to the -5 power) or 1 Real Root. No main program, comments or additional declarations are necessary.
#include <iostream>
using namespace std;
int main()
{
double Discriminant;
cout << "Enter the discriminant of a quadratic equation. ";
cin >> Discriminant;
// Display a message indicating the nature of the equation's roots below.
Part B:
For this problem, you are to write a complete C++ function named f ( ) . The function should have one value parameter of type double. If the name of this parameter is called x, have your function return the value of the tangent of x to the fifth power divided by the square root of the sum e to the x plus 7. No comments or main ( ) program are necessary.
Part C:
For this problem, you are to code a C++ function called Array2File () that has 3 parameters. The first parameter is an ofstream& object that has been initialized to a text file and opened for output before the function was invoked. The second parameter is an array of double values that was initialized from the beginning of the array before the function was invoked. The third parameter is an int that represents the number of initialized values in the array. The function Array2File () should display every initialized element of the array parameter to a separate line of the text file parameter. No comments, additional subprograms or main () program are necessary
Complete the following code segment that reads in the value of Discriminant and should output a message stating whether the variable represents 2 Complex Roots (less than -10 to the -5 power), 2 Real Roots (greater than 10 to the -5 power) or 1 Real Root No main program, comments or additional declarations are necessary Be sure to strike the Enter key before you click on the Save button. #include Kiostream> using namespace std; int main double Discriminant In cout Enter the discriminant of a quadratic equation. cin Discriminant Display a message indicating the nature of the equation's roots below.Explanation / Answer
#include <iostream>
using namespace std;
#include <math.h>
int main()
{
double determinant;
cout << "Enter determinant of a quadratic equation";
cin >> determinant;
// condition for real and different roots
if (determinant > 0)
{
// sqrt() function returns square root
cout << "2 real roots";
}
//condition for real and equal roots
else if (determinant == 0)
{
cout <<"real roots";
}
// if roots are not real
else
{
cout << "Imaginary root";
}
return 0;
}
part b
#include<stdio.h>
#include<math.h>
int main()
{ double x=5,y,ans;
y=pow(x,5);
x=sqrt(exp(x)+7) ;
ans=tanh(y/x);
printf("%ld",ans);
}
part c
void foo (std::ofstream& myFile,int a[][25],int length)
{
myfile.open ("example.txt");
for(int i=0;i<length(a);i++)
{
mfile << a[i] << " ";
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.