How do i take fifth power of a number in c [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am creating a gp calculator in c++ ,But in gp the formulae has common ratio to the power of the term number. in order to get calculate that term i need to know how do i take the number as power for some other number, is there any operator for doing this.

If both arguments are floating point numbers, you have to use formula xᵐ = exp(m log x).
Supposedly std::pow does that for you. If your program requires to match some particular test patterns, further investigation may be required.

Know your <math>
As long as x != 0 to get any power:
exp(log(x)*power)
The interesting tidbit here is that if power is 1.0/y it will extract the y-root of the value.

Related

How to find the maximum number formed with the digits of a given number WITHOUT ARRAYS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I'm really wondering how to solve this problem without using arrays. I have been literally scratching my head for hours without success. Help is highly appreciated!
Let me show you how to achieve this with the number 12365:
12365 (largest digit : 6)
62315 (largest remaining digit : 5)
65312 (largest remaining digit : 3)
65312 (largets remaining digit : 2)
65321
The calculations can be performed, using simple MOD() calculations.

writing c++ program "fraction of double" [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I wanna write a c++ program that read a double value and after reading it print only the fraction of that number, for example if the input was 14.25 then the output must be 0.25
should include iomanip to it?
One approach would be to
Round the number down to the nearest integer - you can use the floor() function (http://www.cplusplus.com/reference/cmath/floor/)
Subtract that integer from the original number to get the result

What is the most efficient way to calculate PI in C? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm have to write a C program, what it does is takes a integer as input. And gives output to the input(th) number of PI after decimal. Like if input is 100, output will be 9(100th digit of pi, after decimal is 9).
What will be the best algorithm for that?
p.s I don't want to save the value of pi into the string, and do it.
Your question is more a math question than a C programming one (so perhaps off-topic). Read first the wikipage on Pi and Approximations of π
If you need to compute only a few hundred (or even hundred thousands) digits, you just need to use some algorithm and code it using some bignum library (e.g. GMPlib, which has mpfr_const_pî ass commented by chtz).
Things become interesting for many billions of digits. I'm not expert on Pi, but look into Fabrice Bellard work on it (read the technical notes mentioning Chudnovsky's algorithm).

C++ input value process as math function [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I’m very new in C++ and I need your help. I want to use the input value as a mathematical function then print the result.
What i need is:
When user input: 2 +1 and hit Enter then output (cout>>)
should be your result is: 3 (the sum of 2 + 1)
The mathematical symbol could be + or * or / or -.
Could you please help me with some example?
Thanks in advance!
Search for "Reverse Polish notation" and implementation in C++

Elliptic Filter Code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm needing a elliptic filter code in c or c++, this code should filter a float input array.
Does anyone there have any code to do it?
Best
If you use e.g. MATLAB to design your filter (using e.g. the ellip function), you can take the resulting filter coefficients and very easily implement the filter in software (it's just a matter of multiplying the float values by the coefficients and following the rational filter equation).