EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
8th Edition
ISBN: 9780357425299
Author: Malik
Publisher: CENGAGE CO
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 6, Problem 15SA
(a)
Program Plan Intro
To give the output of the given program.
(b)
Program Plan Intro
To explain the working of the program.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Description
Develop a C program that computes the different roots in a quadratic equation, ax + bX?=0.
r= -b ± v (b? – 4ac) , rl is the root when the + is used in the equation and r2 is the root when
2a
the – is used. The roots r1 and r2 can only be computed when the discriminant
(b - 4ac) is greater than the zero else the quadratic equation does not have any roots and therefore the
program should display "no roots".
NOTE: sąrt is a built in function in C to extract the roots. The program will prompt to input the values of a, b
and c and output the roots r1 and r2 or no roots at all. Check your answer manually.
Sample Output if Applicable
CT 0:Ruel Lauron\C_Programs\QUAD.exe
Enter the value of a:1
Enter the value of b:-3
Enter the value of c:-10
The value of x1 is 5.00
The value of x2 is -2.00
Explain these c++ statements
void bar(int panam) {panam +=1;}
Sub: Data structure
Consider the following 'C’ routine
int DO ( int a[ ], int /b, int ub)
{
int temp;
if( /b == ub)
return a[lb];
else
{
temp =DO( a, Ib+1, ub);
if (a[/b]<= temp);
return a[/b];
else
return temp;
}
What does DO(a,0,5) return if
a[ ] = {0, –1,10,12,5,8};
Chapter 6 Solutions
EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
Ch. 6 - Mark the following statements as true or false:
a....Ch. 6 - Determine the value of each of the following...Ch. 6 - Determine the value of each of the following...Ch. 6 - Consider the following function definition. (4, 6)...Ch. 6 - Consider the following statements:
Which of the...Ch. 6 - Prob. 8SACh. 6 - Prob. 9SACh. 6 - Why do you need to include function prototypes in...Ch. 6 - Prob. 11SACh. 6 - Consider the following function: (4)...
Ch. 6 - Prob. 15SACh. 6 - What is the output of the following program? (4)
Ch. 6 - Write the definition of a function that takes as...Ch. 6 - Prob. 18SACh. 6 - How would you use a return statement in a void...Ch. 6 - Prob. 20SACh. 6 - Prob. 21SACh. 6 - What is the output of the following program?...Ch. 6 - Write the definition of a void function that takes...Ch. 6 - Write the definition of a void function that takes...Ch. 6 - Prob. 8PECh. 6 - The following formula gives the distance between...Ch. 6 - Write a program that takes as input five numbers...Ch. 6 - When you borrow money to buy a house, a car, or...Ch. 6 - Consider the definition of the function main:...Ch. 6 - The statements in the following program are not in...Ch. 6 - Write a program that outputs inflation rates for...Ch. 6 - Write a program to convert the time from 24-hour...Ch. 6 - Jason opened a coffee shop at the beach and sells...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- PROGRAMMING LANGUAGE: C++ // vectors: overloading operators example#include <iostream>using namespace std;class counter{private:int count;public:counter():count(0){}counter(int c):count(c) {} int get_count(){return count;} counter operator++ (int){return counter(count++); } counter operator-- (int){return counter(count--);}};int main(){counter c1, c2, c3;c1++;c2--;cout<<'\n'<<c1.get_count();cout<<'\n'<<c2.get_count();cout<<endl;c3 = c1++;cout<<'\n'<<c1.get_count();cout<<'\n'<<c3.get_count();getch();return 0;} Go through the above code and write the output of the given code segment. counter c1(5), c2(10), c3;c3=c1++;c2=--c3;;cout<<”\n”<<c1.get_count();cout<<”\n”<<c2.get_count();cout<<”\n”<<c3.get_count();arrow_forwardint func(int a, int b) { return (aarrow_forwardc++ programarrow_forwardint f(int &k){k++;return k * 2;}int main(){int i = 1, j = -1;int a, b, c;a = f(i) + i/2;b = j + f(j) + f(j);c = 2 * f(j);return 0;} What are the values of a, b and c id the operands in the expressions are evaluated from left to right and then what are the values when its evaluated right to left?arrow_forwardExplain this C code line per line please #include <stdio.h> #include <malloc.h> void printArray(int**, int); int main() { int i = 0, j = 0, n = 5; int **arr = (int**)malloc(n * sizeof(int*)); for(int i=0;i<n;i++){ *(arr+i) = (int*)malloc(n*sizeof(int)); } for(i=0;i<n;i++){ for(int j=0;j<n;j++){ *(*(arr+i) + j) = 0; } } printArray(arr, n); for(i=0;i<n;i++){ *( *(arr + i) + i) = i+1; } printArray(arr,n); return 0; } void printArray(int ** array, int size) { int i,j; for(i = 0;i<size;i++){ for(j=0;j<size;j++){ printf("%d ", *( *(array + i) + j)); } printf("\n"); } printf("\n"); }arrow_forward#include<bits/stdc++.h>#include<math.h>using namespace std; class TotalResistance{double series_res,parallel_res,sp_res;public:TotalResistance(){series_res=parallel_res=sp_res=0;}void seriesResistance(double resistance[],int n);void parallelResistance(double resistance[],int n);void spResistance(double resistance[],int n);};void TotalResistance::seriesResistance(double resistance[],int n){for(int i=0;i<n;i++)series_res += resistance[i];cout<<"Total Resistance in series is: "<<series_res<<endl;}void TotalResistance::parallelResistance(double resistance[],int n){double temp=0;for(int i=0;i<n;i++)temp += (1/resistance[i]);parallel_res = 1/temp;cout<<"Total Resistance in parallel is: "<<parallel_res<<endl;}void TotalResistance::spResistance(double resistance[],int n){for(int i=0;i<n;i++)series_res += resistance[i];double temp=0;for(int i=0;i<n;i++)temp += (1/resistance[i]);parallel_res = 1/temp;cout<<"Total Resistance in…arrow_forward#include<bits/stdc++.h>#include<math.h>using namespace std; class TotalResistance{double series_res,parallel_res,sp_res;public:TotalResistance(){series_res=parallel_res=sp_res=0;}void seriesResistance(double resistance[],int n);void parallelResistance(double resistance[],int n);void spResistance(double resistance[],int n);};void TotalResistance::seriesResistance(double resistance[],int n){for(int i=0;i<n;i++)series_res += resistance[i];cout<<"Total Resistance in series is: "<<series_res<<endl;}void TotalResistance::parallelResistance(double resistance[],int n){double temp=0;for(int i=0;i<n;i++)temp += (1/resistance[i]);parallel_res = 1/temp;cout<<"Total Resistance in parallel is: "<<parallel_res<<endl;}void TotalResistance::spResistance(double resistance[],int n){for(int i=0;i<n;i++)series_res += resistance[i];double temp=0;for(int i=0;i<n;i++)temp += (1/resistance[i]);parallel_res = 1/temp;cout<<"Total Resistance in…arrow_forwardrefer to the statment below:arrow_forwardPlease written by computer source a multiple choice for C++ data structure, thanksarrow_forwardPlease explainarrow_forwardc++/data structuresarrow_forwardThe statement int arr[size]; in the following C++ codc in Figure 5 produces an error. This is due to the size of array cannot be initialized dynamically. Thus, constant expression is required. int main () { int size, i; cin>>size; int arr[size); for (i=1; ic=size; i++) { cin>> arr[i]; cout <<"You entered : "<< arr[i]; system ("pause"); return 0; } Figure 5 Answer : Reason :arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education