Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Comment on the output of this C++ code? #include struct temp { int a; int b; int c; }; int main() { struct temp p[] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; return 0; } 1. No Compile time error, generates an array of structure of size 3 2. No Compile time error, generates an array of structure of size 9 3. Compile time error, illegal declaration of a multidimensional array 4. Compile time error, illegal assignment to members of structure


Given two polynomials A and B, write a program that adds the given two polynomials A and B.Input


The first line contains a single integer M.

Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A.

After that next line contains a single integer N.

Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.Output

Print the addition of polynomials A and B.

The format for printing polynomials is: Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0, where Pi's are powers in decreasing order, Ci is co-efficient and C0 is constant, there will be space before and after the plus or minus sign.

If co-efficient is zero then don't print the term.

If the term with highest degree is negative, the term should be represented as -Cix^Pi.



Given polynomial, write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0 format.Input


The first line contains a single integer N.

Next N lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.Output


Print the polynomial in the format Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0, where Pi's are powers in decreasing order, Ci is coefficient, and C0 is constant. There will be space before and after the plus or minus sign.

If the coefficient is zero, then don't print the term.

If the term with the highest degree is negative, the term should represent -Cix^Pi.

For the term where power is 1, represent it as C1x instead of C1x^1.

If the polynomial degree is zero and the constant term is also zero, then print 0 to represent the polynomial.

For term Cix^Pi, if the coefficient of the term Ci is 1, print x^Pi instead of 1x^Pi.Explana

"6x^3 + 10x^2 + 5"Constraints


N <= 100

0 <= Pi < 1000

-1000 <= Ci <= 1000


Given polynomial, write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0 format.

Input

The first line contains a single integer N.

Next N lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.

Output

Print the polynomial in the format Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0, where Pi's are powers in decreasing order, Ci is coefficient, and C0 is constant. There will be space before and after the plus or minus sign.

If the coefficient is zero, then don't print the term.

If the term with the highest degree is negative, the term should represent -Cix^Pi.

For the term where power is 1, represent it as C1x instead of C1x^1.

If the polynomial degree is zero and the constant term is also zero, then print 0 to represent the polynomial.

For term Cix^Pi, if the coefficient of the term Ci is 1, print x^Pi instead of 1x^Pi.

Sample Input

5

0 2

1 3

2 1

4 7

3 6

Output:

7x^4 + 6x^3 + x^2 + 3x + 2

Write a c++ program on the topic myself.The program must have 15 cout statement but the output must be on ten lines. The first output line must be heading of the message and the second must be underline between the last but one line and the last line of your output there must be three line spaces .your program must both have end line or new line


Write a program to elaborate the concept of function overloading using pointers as a function arguments.


What is meant by Fibonacci series/sequence? Write a program to generate Fibonacci sequence by using user defined functions. 


 write a class employee that contains attributes of employee id and his scale.the class contains member functions to input and show <b><i>the</i></b> attribute.Write a child class manager that inherits Employee class.The child class has attributes of manager id and his department. It also contains the member functions to input and show its <b><i>attributes</i></b>


Write a program that reads in 10 midday temperatures for Port Elizabeth, for 10 consecutive days. Only temperatures higher than 0 and less than 45 are valid (working with integer values for temperatures). It must calculate and display the following:  The warmest temperature  The average temperature.  The number of days that the temperature was higher than 30.


Design a program that calculates a person’s body mass index (BMI).

BMI is often used to determine whether a person with a sedentary

lifestyle is overweight or underweight for his or her height. A person’s

BMI is calculated with the following formula:

In the formula, weight is measured in pounds and height is measured in

inches. Enhance the program so it displays a message indicating

whether the person has optimal weight, is underweight, or is overweight.

A sedentary person’s weight is considered to be optimal if his or her BMI

is between 18.5 and 25. If the BMI is less than 18.5, the person is

considered to be underweight. If the BMI value is greater than 25, the

person is considered to be overweight


LATEST TUTORIALS
APPROVED BY CLIENTS