Question

Complete the following function to return a value equal to Using C program x^3+x^2+x (4 points)...

  1. Complete the following function to return a value equal to Using C program

x^3+x^2+x

(4 points)

int    myFunc(int x)

{

}

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

int myFunc(int x)

{

int r=0;

r=pow(x,3)+pow(x,2)+x;

return (r);

}

Explanation

pow function in c:

pow(x,y) gives x^y

Add a comment
Know the answer?
Add Answer to:
Complete the following function to return a value equal to Using C program x^3+x^2+x (4 points)...
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
  • Complete a partially written C++ program that includes a function that return a value. The program...

    Complete a partially written C++ program that includes a function that return a value. The program is a simple calculator that prompts the user of 2 number and an operation (+, -, * or, /). The two number and the operator are passed to the function where the appropriate arithmetic operation is performed. The result is return to the main function () where the arithmetic operation and result are displayed. For example 3 * 4 = 12 The source code...

  • 4. Write a function that returns a value to the main program illustrated below. In the...

    4. Write a function that returns a value to the main program illustrated below. In the function, the variable passed by the main program needs to be evaluated using a switch statement. The value returned is determined by the case that it matches. (10 points) If value is: return 10 return 20 3 return 30 Anything else, return 0 Main program: #include <iostream> using namespace std; int findValue (int); int main) { Int numb, retvalue cout << "In Enter a...

  • For each of the following function calls, please write if the parameter is passed by value...

    For each of the following function calls, please write if the parameter is passed by value or passed by reference to a hypothetical function 'myFunc'. You should briefly explain why to get full credit. Q7.1 3 Points int num = 5; myFunc(num); Q7.2 3 Points int num = 5; myFunc(&num); Q7.3 3 Points int num[] = {5}; myFunc(num); Q7.4 3 Points int num[] = {5,6,7,8,9}; myFunc(num); Q7.5 3 Points char name[6] = "Hello"; myFunc(name);

  • c++ Note: Do not use using namespace std; Use std:: Use comments for clear understanding TEST...

    c++ Note: Do not use using namespace std; Use std:: Use comments for clear understanding TEST THE PROGRAM. 1) Create a c++ program to run a simple experiment to see how reference parameters work. 2) You need to add a “&” symbol after the parameter type specification to set up a reference parameter: int myfunc (int & x) { x = 11; return -11; } int testdata = 0; int y; y= myfunc (testdata); 3) Now, You can get a...

  • Question 19 4 pts Using the program below, please complete the program by adding 2 functions...

    Question 19 4 pts Using the program below, please complete the program by adding 2 functions as follow: 1. A function named getAverage that calculates and returns the Average. 2. A function named getMaximum that returns the maximum of the three numbers. Make sure to use the proper data types for all variables and functions. #include <iostream> using namespace std; //function getAverage //function getMaximum int main(int argc, char** argv) { int x, y, z; cout << "Enter three whole numbers:...

  • 4. Consider the following C program: (2 points) int fun( int *j){ + 11; return 9;...

    4. Consider the following C program: (2 points) int fun( int *j){ + 11; return 9; } void main(){ int k 2; k + fun( &k); k What is the value of k after the assignment statement in main, assuming operands are evaluated left to right. operands are evaluated right to left. Please, also explain how you got the values in detail.

  • Please help ASAP Question 3 (10 points): Using pointer notation, complete the C++ function below using...

    Please help ASAP Question 3 (10 points): Using pointer notation, complete the C++ function below using pointcr notations The function takes N characters in character array A and return true if the characters are consecutive and fahe otherwise. bool consecutiveChars(char A, int N) char first; // Pointer to the first character in A char last; // Pointer to the last character in A Your code here.. #include <iostream> #include <cctype> using namespace std; bool consecutiveChars(char* A, int N): nt main0...

  • C PROGRAMMING ONLY 22 2 points Write a function for the following specs: • type: int...

    C PROGRAMMING ONLY 22 2 points Write a function for the following specs: • type: int • parameter: character array • Behavior: o Open the file using the parameter for the file name in read mode. o Return O if the file opened successfully, 1 if unable to open the file. В І о A- A Ex x, EE 12 23 2 points Write a function for the following specs: type: void • parameters: FILE", int[], int size Behavior: o...

  • a) Make a function which returns x/3 with a given integer x. double third(int x) {...

    a) Make a function which returns x/3 with a given integer x. double third(int x) { //Complete your code below. ______________________________________ return y; } b) Make a program which shows 2 ∗ n with a given user input n. #include<iostream> using namespace std; // Complete the blank. _______________________ int main(){ int n; cout<<"Enter:"; cin>>n; cout<<twice(n); return 0; } int twice(int x){ return 2*x; } c) Make a function which returns true if n is positive, otherwise returns false. ________ positive(int...

  • Question 16 (4 points) Write a complete C program that declares four variables of type integer...

    Question 16 (4 points) Write a complete C program that declares four variables of type integer (i.e integer variables) and four variables of type pointer to integer (i.e. integer pointers). Assign the addresses into the pointers. Using the indirection operator with a pointer, assign the values 1, 2, 3, and 4 into the four integers. (Use the indirection operator with the pointers to write the integer values.) Your program should write the addresses and values of all eight variables to...

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
ADVERTISEMENT