Question

#include <iostream>
#include <cmath>

using namespace std;

int main()
{

int x;
int y;
int z;
int r1;
int r2;
cin >> x;
cin >> y;
cin >> z;
r1 = 4* pow(x,3)-5*pow(y,2)+3*z;
r2 = r1+7*pow(x,3)-2*pow(y,2)+11*z;

cout << "r1=";
cout << 4* pow(x,3)-5*pow(y,2)+3*z;
cout << endl;
cout << "r2=";
cout << r1+7*pow(x,3)-2*pow(y,2)+11*z;
cout << endl;
cout << "r3=";
cout << r2-9*pow(x,3)+22*pow(y,2)-6*z;
cout << endl;

return 0;
}

1-115 Your output r2-395 13-186 5:Compare output Output differs. See highlights below. -163 97218 1-1,7235 3--7.271699 1-17235 3--7271690 Input202 Your output 2--4.6562Be+07 Expected output 2-46562 6: Compare output Results hidden by your instructor

0 0
Add a comment Improve this question Transcribed image text
Answer #1
// Sample Output
   -163
   -202
   97218
 
r1=-17235354
r2=-46562793
r3=-7271690

// Code

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

int x;

int y;

int z;

int r1;

int r2;

cin >> x;

cin >> y;

cin >> z;

r1 = 4* pow(x,3)-5*pow(y,2)+3*z;

r2 = r1+7*pow(x,3)-2*pow(y,2)+11*z;

cout << "r1=";

int one = 4* pow(x,3)-5*pow(y,2)+3*z;

cout << one;

cout << endl;

cout << "r2=";

int two = r1+7*pow(x,3)-2*pow(y,2)+11*z;

cout << two;

cout << endl;

cout << "r3=";

int three = r2-9*pow(x,3)+22*pow(y,2)-6*z;

cout << three;

cout << endl;

return 0;

}

Add a comment
Know the answer?
Add Answer to:
#include <iostream> #include <cmath> using namespace std; int main() { int x; int y; int z;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is the output of this program? #include<iostream> using namespace std; int main() { int x=4,...

    What is the output of this program? #include<iostream> using namespace std; int main() { int x=4, y=4, z=4; x += 2; y = z++; z = ++x + y; cout<<x<<" "<<y<<" "<<z<<endl; return 0; } Group of answer choices 4 4 4 7 4 11 7 5 12 6 5 11

  • #include <iostream> #include <chrono> using namespace std; double improvedPow(double x, int y) { // To be...

    #include <iostream> #include <chrono> using namespace std; double improvedPow(double x, int y) { // To be implemented by you } int main() { cout << "To calculate x^y ..." << endl; double x; int y; cout << "Please enter x: "; cin >> x; cout << "Please enter y: "; cin >> y; if(x == 0) { if (y > 0) cout << 0 << endl; else cout << "x^y is not defined" <<endl; } else { cout << improvedPow(x,y)...

  • Program 2 #include <iostream> #include <cmath> using namespace std; int main() {        const double PI...

    Program 2 #include <iostream> #include <cmath> using namespace std; int main() {        const double PI = 3.141592653;        int degrees;        double radians;        cout << "Enter a value for the degree of an angle\n";        cin >> degrees;        // translate the formula for converting degrees to radians into C++:        //            // degrees x PI        // ------------   = radians        //     180        radians = _____________________________________;        // Refer to p. 127 for help below....

  • What is the difference between these two programs? #include <iostream> using namespace std; int DontPanic(int &...

    What is the difference between these two programs? #include <iostream> using namespace std; int DontPanic(int & x); int z = 10; void main() { char x = 'y'; int y = 5; int z = 100; y = DontPanic(z); cout << x << " " << y << " " << z << endl; } int DontPanic(int & x) { int * p; p = & z; x = (*p)++ + 1; cout << x << " " << *p...

  • #include <iostream> #include <string> using namespace std; int main() { int number; int sum = 0;...

    #include <iostream> #include <string> using namespace std; int main() { int number; int sum = 0; while(true) { cout << "Please enter a number between 1 and 11: "; cin >> number; if (number >= 1 && number <= 11) { cout << number << endl; sum = sum + number; //only add the sum when number is in range: 1-11, so add wthin this if case } else { cout << number << endl; cout << "Out of range;...

  • #include <iostream> #include <conio.h> #include<limits> using namespace std; int main(){ char oparand, ch = 'Y'; int...

    #include <iostream> #include <conio.h> #include<limits> using namespace std; int main(){ char oparand, ch = 'Y'; int num1, num2, result; while(ch == 'Y'){ cout << "Enter first number: "; cin >> num1; while(1){//for handling invalid inputs if(cin.fail()){ cin.clear();//reseting the buffer cin.ignore(numeric_limits<streamsize>::max(),'\n');//empty the buffer cout<<"You have entered wrong input"<<endl; cout << "Enter first number: "; cin >> num1; } if(!cin.fail()) break; } cout << "Enter second number: "; cin >> num2; while(1){ if(cin.fail()){ cin.clear(); cin.ignore(numeric_limits<streamsize>::max(),'\n'); cout<<"You have entered wrong input"<<endl; cout <<...

  • Flow chart of this program #include <iostream> #include <cmath> using namespace std; int mainO double sum=0.0,...

    Flow chart of this program #include <iostream> #include <cmath> using namespace std; int mainO double sum=0.0, ave-ee, int locmx, locmn int n; cout <<"Enter the number of students: "<<endl; cin >> ni double listln]; double max-0; double min-e; for (int i-e ; i<n ;i++) cout<s enter the gpa: "<cendli cin>>listli]; while (listlile i listli1>4) cout<s error,Try again "<cendl; cin>listlil: sun+=list[i]; N1 if (listli]>max) for(int isin itt) max=list [i]; 10cmx=1+1 ; else if (list [i] min) min=list [i]; locmn-i+1; ave sum/n;...

  • EXPLAIN HOW THIS PROGRAM WORKS, USING DEV C++ #include <iostream> #include <cmath> #define PI 3.1415926535897 using...

    EXPLAIN HOW THIS PROGRAM WORKS, USING DEV C++ #include <iostream> #include <cmath> #define PI 3.1415926535897 using namespace std; typedef struct ComplexRectStruct {    double real;    double imaginary; } ComplexRect; typedef struct ComplexPolarStruct {    double magnitude;    double angle; } ComplexPolar; double radToDegree (double rad) {    return (180.00 * rad) / PI; } double degToRadian (double deg) {    return (deg * PI) / 180; } ComplexPolar toPolar (ComplexRect r) {    ComplexPolar p;    p.magnitude = round(sqrt(pow(r.real,...

  • #include <iostream> using namespace std; int main() {    int sumOdd = 0; // For accumulating...

    #include <iostream> using namespace std; int main() {    int sumOdd = 0; // For accumulating odd numbers, init to 0    int sumEven = 0; // For accumulating even numbers, init to 0    int upperbound; // Sum from 1 to this upperbound    // Prompt user for an upperbound    cout << "Enter the upperbound: ";    cin >> upperbound;    // Use a loop to repeatedly add 1, 2, 3,..., up to upperbound    int number =...

  • Consider the following C++ program: #include <iostream> #include <cstdlib> using namespace std; int main int n...

    Consider the following C++ program: #include <iostream> #include <cstdlib> using namespace std; int main int n =0; int i = 0; cout << "Please enter a strictly positive number:"; cin >> n if (n <= 0) exit(EXIT_FAILURE) while (n > 1) n-n/2; i << endl; cout"Output:" return 0; Answer the following questions: What is the output of the program for each of the following values of n: -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9? What does...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT