(Electrical eng.) The amplification of electronic circuits is measured in units of decibels, which is calculated as the following:
Po is the power of the output signal, and Pi is the power of the input signal. Using this formula, write, compile, and run a C++
Trending nowThis is a popular solution!
Chapter 3 Solutions
C++ for Engineers and Scientists
- (permu_combi.cpp), that .arrow_forward2. (Guess the Number) Write a C program that plays the game of "guess the number" as fol- lows: Your program chooses the number to be guessed by selecting an integer at random in the range 1 to 1000. The program then types: 5.32 I have a number between 1 and 1000. Can you guess my number? Please type your first guess. The player then types a first guess. The program responds with one of the following: 1. Excellent! You guessed the number! Would you like to play again (y or n)? 2. Too low. Try again. 3. Too high. Try again. If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program should keep telling the player Too high or Too low to help the player “zero in" on the correct answer. [Note: The searching technique employed in this problem is called binary search. We'll say more about this in the next problem.]arrow_forward(use C++ program) Note: Write the defining diagram first, the solution (written either in pseudocode or flowchart) and the last one is the C++ program. 1. Write a program for asking for a quiz score. The program then will display a remark if FAILED or PASSED. The passing score is 50. 2. Write a program for comparing two input numbers if which of the two is greater.arrow_forward
- (C PROGRAMMING ONLY!) DO NOT EDIT ANYTHING IN THE MAIN 1. Dog Codesby CodeChum Admin In the military, they have these military dogs that help them in their missions. To handle them very well, they assign a code to each of the dogs. This has only been partially implemented though and they would need your help to finish this. Instructions: In the code editor, there are multiple printf messages where each printf prints a dog code's value.Your task is to create an enum, DogCode, and set its values to the following:CODE_1 = 'j'CODE_2 = 'r'CODE_3= 'v'CODE_4= 'd'CODE_5 = 'l'CODE_6 = 'y'DO NOT EDIT ANYTHING IN THE MAINOutput Dog Code #1 = fDog Code #2 = aDog Code #3 = z...arrow_forwarduse python codearrow_forward(C++) Question: Write a function string middle(string str)that returns a string containing the middle character in str if the length of str is odd, or the two middle characters if the length is even. For example, middle("middle") returns "dd". I'm not getting the correct output. What am I doing incorrectly?arrow_forward
- (Find the two lowest scores) Write a c++ program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the lowest score and the student with the second-lowest score.arrow_forwardPlease solve itarrow_forwardYou must answer the Problem in C++. (Anagrams) Write a function that checks whether two words are anagrams. Two words are anagrams if they contain the same letters in any order. For example, “silent” and “listen” are anagrams. The header of the function is as follows: bool isAnagram(const string& s1, const string& s2) Write a test program that prompts the user to enter two strings and checks whether they are anagrams. Sample Run 1 Enter a string s1: silent Enter a string s2: listen silent and listen are anagrams Sample Run 2 Enter a string s1: split Enter a string s2: lisp split and lisp are not anagramsarrow_forward
- (Drawing Patterns with Nested for Loops) Write a c++ program that uses for statements to print the following patterns separately, one below the other. Use for loops to generate the patterns. All asterisks (*) should be printed by a single statement of the form cout « '*'; (this causes the asterisks to print side by side). [Hint: The last two patterns require that each line begin with an appropriate number of blanks. Extra credit: Combine your code from the four separate problems into a single program that prints all four patterns side by side by making clever use of nested for loops.arrow_forwardDO A CODE PER LETTER IN NO.4. DO IT IN C++ I NEED 3 CODES. PLEASE DO IT ACCORDING TO THE INSTRUCTION. DONT DO IT AS ONE, DO IT SEPARATELY. THANK YOU SO MUCH A. FUNCTION HEADER B. FUNCTION PROTOTYPE C. PARAMETERS AND RETURNarrow_forward(25 min) The following table shows the foreign exchange rates for a few currencies. Foreign Currency RM USD (D) 1 Dollar 4.16 GBP (P) 1 Pound 5.68 KRW (W) 1000 Won 3.51 JPY (Y) 100 Yen 3.69 Develop a complete C++ program that will prompt the user to enter the currency preferred and the amount required. The program should include a function with the following prototype: double CurrencyBuy(char, double): The first parameter in the function prototype is for the type of currency where the characters D, P, W and Y represent Dollar, Pound, Won and Yen respectively. The second parameter is the amount to be bought. This function CurrencyBuy should return, to the calling function, the payment to be paid in RM. A sample of the output is given as follows. Foreign Exchange Currency Country Code USD (D) GВР (Р) KRW (W) JPY (Y) Enter the country code: D Enter the amount to be bought: 300 Payment due is RM 1248.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr