🎁BACK-TO-SCHOOL DEAL. Subscribe Now to get 40% OFF at only 8.49 USD/month, only valid until Sep 30th, 2024

Question

100.0 % 40 in C++?

Asked By TwilightSerenade45 at

Answered By Expert

Scott

Expert · 5.9k answers · 5k people helped

I\n#include<iostream>\n#include<string>\nusing namespace std:\nint main() (\ncout << (100.0 % 40);\nreturn 0:\nmpile Log Debug\nFind

Explanation

Because %(the modulus operator) is only defined for integer data types.

this operator is not defined for double type.

same result will come for bitwise operators like "&,^,|,~,<<,>>" .

 

If You want to overcome this problem. you can use fmod

#include<iostream»\n1\n#include< string>\n3\n2\n#include<math.h>\nstd;\n外\nusing namespace %i31:,\n5\nint main()(\n6\n7\n8\ncout << fmod(10

 

🧑‍🏫 More Questions

4. Starfish Corporation, in preparation of its December 31, 2017, financial statements, is attempting to determine the proper accounting treatment for each of the following situations. 1. As a result of uninsured accidents during the year, personal injury suits for $261,000 and $697,000 have been filed against the company. It is the judgment of Starfish's legal counsel that an unfavorable outcome is unlikely in the $261,000 case but that an unfavorable verdict approximating $410,000 will probably result in the $697,000 case. 2. Starfish's deep sea exploration division consisting of operations in the Marina Trench is uninsurable because of the special risk of injury to employees and losses due to high pressure. The year 2017 is considered one of tipesafest (luckiest) in the division's history because no loss due to injury or casualty was suffered. Having suffered an average of two casualties a year during the rest of the past decade (ranging from $25,000 to $1,000,000), management is certain that next year the company will probably not be so fortunate. 3. Starfish Corporation owns a subsidiary in a foreign country that has a book value of $21,600,000 and an estimated fair value of $30,890,000. The foreign government has communicated to Starfish its intention to expropriate the assets and business of all foreign investors. On the basis of settlements other firms have received from this same 3. Starfish Corporation owns a subsidiary in a foreign country that has a book value of $21,600,000 and an estimated fair value of $30,890,000. The foreign government has communicated to Starfish its intention to expropriate the assets and business of all foreign investors. On the basis of settlements other firms have received from this same country, Starfish expects to receive 60% of the fair value of its properties as final settlement. Instructions (a) Prepare the journal entries that should be recorded as of December 31, 2017, to recognize each of the situations above. (b) Indicate what should be reported relative to each situation in the financial statements and accompanying notes. Explain why.

Problem 2 - Minor Key Here is a list of musical notes, written with flats (rather than sharps): CDb, D, Eb, E, F, Gb,G,Ab. ABb. B, C in the next octave) Observe that not all notes have flats, Le.Cflat is actually B which is not a black key on the piano for instance The harmonic minor scale is composed of the following sequence of steps: Step] [ Step) | Step) [Step] [13 Step] [1% Step] [ Step] For instance, the Charmonic minor scale is C, D, E, F, G, A.B.C. Each musical "half step" is a single step through the list, the name half-step predates computers so you have to forgive musicians a little. The Eb harmonic minor scale is Eb F Gb Ab Bb BDE The G harmonic minor scale is GABb CDE5 GbG Define a list: MUSICAL NOTES - ['c', D\u2660', 'D', 'E\0266d', TE", "Gu2663', 'G', A\u266d', 'A', '\u2660". Note that \u266d' is the unicode for the flat symbol Allow the user to enter starting notes like: "E* or "B flat" or "flat" You will have to calculate the starting note from this, or if it's not a note, for instance if they enter "R" Then display the harmonic minor scale starting at that note, or an error message indicating that it is not a note. When the user enters "quit then stop asking for notes and exit the program, My suggestion is that you break this problem down into parts: 1) Translate the input into the musical notation by creating a Thelper function' which takes as a parameter the user's input and outputs the proper note, meaning it will replace 'flat' with b and remove the space, so that it matches the description in the list of strings. 2) Compute the starting index in the list of musical notes or determine that the starting index doesn't exist because the note isn't a real note. I use another helper function for this purpose. 3) Calculate the scale itself in a slightly bigger function but then return it as a list. 4) Outside of your function, implement a main loop where you will join the answer together and output it. This is generally how programmers think about problems. We attempt to break each problem into subproblems which we can write small functions to solve. Then we put those functions together and get our final results. Sample Output linux5[109] python3 minor_key py Enter a starting note (D. E flat): G GAB CD EGG Enter a starting note (C, D flat): A ABCDETA A Enter a starting note (c, Dalat): A flat A B B D E EGA Enter a starting note (C, D flat): flat There is no starting note R. Enter a starting note (C, D flat): quit linux5[110]\ python3 minor_key.PY Enter a starting note (D, E flat): C CDEFGABC Enter a starting note (C, D flat): D DEFGAB DD Enter a starting note (C, D flat): E flat EFG A B BDE Enter a starting note c, flat): G GAB CD EGG Enter a starting note (C, D flat): flat DEEA ACD Enter at ting note (C, D flat): quit