Computers and Technology

On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies.

Output each floating-point value with two digits after the decimal point, which can be achieved by executing
cout << fixed << setprecision(2); once before all other cout statements.

Ex: If the input is:

440.0
(which is the A key near the middle of a piano keyboard), the output is:

440.00 466.16 493.88 523.25 554.37
#include
#include
#include
using namespace std;

int main()
{
double fn, f0, r;
int n=4;// n being 1, 2, 3, and finally 4.
r =pow(2.0,(1.0 / 12.0));
cout << fixed < cin >> f0;
cout << f0 <<" ";
for (int i = 1; i <= n; i++)
{
//calculate
fn = f0 *pow(r , i);
cout << fn <<" ";
}
cout <
return 0;
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:30, enazer
Type the correct answer in the box. spell all words correctly. what kind of graph or chart does this image represent? the given image represents a (blank).
Answers: 2
image
Computers and Technology, 22.06.2019 22:20, kaiyerecampbell95
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
image
Computers and Technology, 23.06.2019 00:00, puppylove899
Which is the correct sequence of steps to set up a document in landscape orientation? a. select page setup from the file menu. then click the margins tab and select landscape. b. select page setup from the edit menu. then click the margins tab and select landscape. c. select page setup from the insert menu. then click the margins tab and select landscape. d. select page setup from the format menu. then click the margins tab and select landscape
Answers: 1
image
Computers and Technology, 23.06.2019 01:10, brooklynneramos9956
Problem 1 - hashing we would like to use initials to locate an individual. for instance, mel should locate the person mark e. lehr. note: this is all upper case. generate a hash function for the above using the numbers on your telephone. you know, each letter has a number associated with it, so examine your telephone keypad. generate 512 random 3 letter initials and take statistics on a linked list array size 512 to hold this information report how many have no elements, 1 element, 2 elements, does this agree with the hashing statistics distribution?
Answers: 1
Do you know the correct answer?
On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 *...

Questions in other subjects:

Konu
Mathematics, 23.08.2021 01:00
Konu
Mathematics, 23.08.2021 01:00
Konu
Computers and Technology, 23.08.2021 01:00
Konu
Mathematics, 23.08.2021 01:00
Konu
Mathematics, 23.08.2021 01:00