Question

Evaluating Equations with One Unknown Loops can be constructed to give you a way to determine...

Evaluating Equations with One Unknown

Loops can be constructed to give you a way to determine and display the values of a single unknown in an equation for a set of values over any specified interval. For example, suppose you want to know the values of y in the following equation for x between 2 and 6: y = 10x2+ 3x – 2

Write a C++ program for this example.

Assuming x has been declared as an integer variable, use for loop to calculate the y value for each x between 2 and 6. Output your results. y = 10 * pow(x,2.0) + 3 * x – 2; //code for calculating y value for each x cout << setw(4) << x << setw(11) << y << endl; //code for output each x and y

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

#include <iostream>
#include<iomanip>
#include<cmath>
using namespace std;


// Driver program
int main()
{
for(int x=2;x<=6;x++)
{
int y = 10 * pow(x,2.0) + 3 * x-2; //code for calculating y
cout << setw(4) << x << setw(11) << y << endl; //code for output each x and y
}

}

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Evaluating Equations with One Unknown Loops can be constructed to give you a way to determine...
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
  • Can you please explain what does each sentence mean and give an example if it’s possible?....

    Can you please explain what does each sentence mean and give an example if it’s possible?. I need to have answers for all of them please Assignment Statements- Input- cin >> Output--cout << endl<"n" Output formatting Arithmetic operators +-'* / % Relational Operators-=-= ++- Logical Operators ! && II Evaluating Expressions of mixed type Evaluating Boolean Expressions Type Conversion, Implicit Coersion Explicit-Type Casting Control Structure: Sequence, decision (branching), looping (repetition) if, if-else, if/else-if/else, nested ifs switch statement conditional statement while...

  • Right now, program pushes all data to screen in three loops need to prompt user for...

    Right now, program pushes all data to screen in three loops need to prompt user for three text files, and need to push data from each loop into those three text files. #include #include #include #include #include #include #include #include using namespace std; double random(double minprice, double maxprice); string printRandomString(int n); bool coinToss(); int clicks(); int runme(); int createfiles(); struct things{     //things();     int id;     string name;     string category;     double price;     bool two_day_shipping;     int...

  • I'm trying to write a program that can ask a user about what type of solid...

    I'm trying to write a program that can ask a user about what type of solid they have and to be able to enter values like radius and length of the shape so the program can calculate the volume of a shape and print the result. I also want to give them a repeating option to input another shape if they want to. I'm trying to use at least 7 functions that can display an output, the volumes of a...

  • Question 1 (8 points): Choose the Correct Answer (2 points for each question) 1. What are...

    Question 1 (8 points): Choose the Correct Answer (2 points for each question) 1. What are the values of the variables x and y after executing the following code? intx=0,y-2; if (x0) y-13 else y-2;) c, x = 1,y=1 d.x-1,y 2 of the following will output Yes only if the integer variable numis either 2.3, 4, or 5? a. if ((2--num) II (nurn<-5)) {cout << "Yes" << endl; } miT b. İfQ2(num) & (num >-5)) {cout << "Yes"くくendl; } c....

  • Explain step by step how to solve this problem. I need it ASAP. Problem 4. ngsYou...

    Explain step by step how to solve this problem. I need it ASAP. Problem 4. ngsYou Chapter 2pds tps://csīw.csicuryedu/supernova 7/Rles/robbins/CSC270/LECTUREREVENN/Chapter%202 pdf ADVANCED HAND IN HW #3 READ STUDY 2.4.2.5.2.7,28.2.9 (skip 2.3,2.6) DO THE FOLLOWING EXAM PRACTICE part 1. PROBLEMS AT THE END OF CHAPTER 2. #14 TO #20 Both editions of the text, 10 PTS part2 #2, write the c++ code for this formula 27 points T- 2T(Lcos()/g)12 3 PTS 3. Write the algebraic formula for the following c++ code...

  • The following C++  code contains an incomplete program that should be able to calculate the distance between...

    The following C++  code contains an incomplete program that should be able to calculate the distance between a series of geocoded locations. Two parts of the program need to be completed: 1. The portion of the main() function that calculates the distances between each of the hard-coded 5 locations, and stores it in a two-dimensional array declared as distances. 2. A portion of the calculateDistanceBetweenLocations(l1, l2) function; omitted code spaces are designed with a // TODO: comment. The code is properly...

  • This is a C++ assignment that I'm trying to create and would like some help understanding...

    This is a C++ assignment that I'm trying to create and would like some help understanding while loops, with possible integration of for loops and if statements. This program only uses while, for, and if. I have some code that I have started, but where to go from there is what's giving me some trouble. This is involves a sentinel controlled while loop, and there are a lot of specifications below that I must have in the program. The program...

  • QUESTION 1 What is the output of the following code snippet? int main() { bool attendance...

    QUESTION 1 What is the output of the following code snippet? int main() { bool attendance = false; string str = "Unknown"; attendance = !(attendance); if (!attendance) { str = "False"; } if (attendance) { attendance = false; } if (attendance) { str = "True"; } else { str = "Maybe"; } cout << str << endl; return 0; } False True Unknown Maybe QUESTION 2 What is the output of the following code snippet? #include <iostream> #include <string> using...

  • c++ only. Please read directions. I'm looking to have each line re-written in a way that...

    c++ only. Please read directions. I'm looking to have each line re-written in a way that shows we're using the walk through method that the pointer is shifting by each value to solve this. Example far below shows what not to do.   Rewrite this program and remove the variable declared at line A below. Make your revised program generate the exact same output as the original without using the variable declared at line A. #include <iostream> using namespace std; int...

  • USE THE TABLE AND OUTPUT TECHNIQUE FOR THIS 8 POINT PROBLEM What is the output from...

    USE THE TABLE AND OUTPUT TECHNIQUE FOR THIS 8 POINT PROBLEM What is the output from the following SEGMENT: note TYPES OF PARAMETERS AND VARIABLE SCOPES Hint: A table is not necessary but it may help you get the output and its order int (4), C(2): HINT THESE ARE GLOBAL int TestMe(int &Y, int Z) / PROTOTYPE FOR THE FUNCTION int main 0 int A BW: A = 4: B-3 W = Test Me A, B) MI CALL TO THE...

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