Hexadecimal numerals are integers written in base 16. The 16 digits used are ‘0’ through ‘9’ plus ‘a’ for the “digit 10”, ‘b’ for the “digit 11”, ‘c’ for the “digit 12”, ‘d’ for the “digit 13”, ‘e’ for the “digit 14”, and ‘f’ for the “digit 15”. For example, the hexadecimal numeral d is the same as base 10 numeral 13 and the hexadecimal numeral 1d is the same as the base 10 numeral 29. Write a C++
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Concepts Of Programming Languages
Absolute Java (6th Edition)
C How to Program (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
- Two number systems, octal (base 8) and hexadecimal (base 16), are of interest to computer scientists. In fact, in C++, you can instruct the computer to store a number in octal or hexadecimal. The digits in the octal number system are 0,1,2,3,4,5,6, and 7. The digits in hexadecimal number systems are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F. So A in hexadecimal is 10 in decimal, B is 11 in decimal, and so on. The algorithm to convert a positive decimal number into an equivalent number in an octal (or hexadecimal) is the same for binary numbers. Here, we divide the decimal number by 8(for octal) and by 16(for hexadecimal). Suppose ab represents the number a to the base b. For example, 7510 means 75 to the base 10(that is decimal), and 8316 means 83 to the base 16(that is hexadecimal). Then 75310 =13618 and 75310= 2F116* Write a program that uses a recursive function to convert a number in decimal to base 8 or base 16.It is necessary that the user enters a nonnegative integer. Check…arrow_forwardin the United States, telephone numbers consist of a three digit area code followed by a seven digit local number. Suppose neither the first digit of an area code nor the first digit of a local number can be a zero but that all other choices are acceptable. do not use commas when you write your number. For example enter 3356789 NOT 3,456,789arrow_forwardThe "e" number is an important constant real number in mathematics and engineering science.It's definition of natural logarithm and also an irrational number.Approximate value is e=2.718281828459045235360287471352662497757247.....In the following equation which discovered by Harlan A. Brothers and John A. Knox, the greater the number "x", the result approximates the actual number "e".((2x+1)/(2x-1))^x Code a "C" program to calculate the approximate value of "e" by increasing the value of "x" (x=1, x=2, x=3...)Let the value of "x" continue to increase (if the difference is bigger) until the difference between the results from the equations and value 2.718281 is less than 0.000001.When the difference is less than 0.000001, project the x value at that moment and the result obtained from the equation on the screen.arrow_forward
- With the aid of c++, write a program that asks the user to enter a number.The program then asks the user to enter the number of permutations needed to calculate the lexicographic arrangement of the entered number.Finally the program calculates the lexicographic order of the number entered based on the number of permutations chosen.arrow_forwardSoundex System Soundex is a system that encodes a word into a letter followed by three digtis that roughly describe how the word sounds. That is, similar sounding words have similar four-character codes. For instance, the words carrot and caret are both coded as C123. A slight variation of the Soundex coding algorithm is as follows: 1. Retain the first letter. 2. For the remaining letters, delete all occurrences of a, e, i, o, u, h, y, and w. 3. Replace the letters that remain with numbers so that (a) b, f, p, and v become 1 (b) c, g, j, k, q, s, x, and z become 2 (c) d and t both become 3 (d) l (that is, el) becomes 4 (e) m and n become 5 (f) r becomes 6 4. If the result contains two adjacent identical digits, eliminate the second of them. 5. Keep only the first four characters of what you have left. If you have fewer than four, then add zeros on the end to make the string have length four. Write a program that carries out the algorithm. See Fig. 6.86.arrow_forwardSoundex System Soundex is a system that encodes a word into a letter followed by three digtis that roughly describe how the word sounds. That is, similar sounding words have similar four-character codes. For instance, the words carrot and caret are both coded as C123. A slight variation of the Soundex coding algorithm is as follows: 1. Retain the first letter. 2. For the remaining letters, delete all occurrences of a, e, i, o, u, h, y, and w. 3. Replace the letters that remain with numbers so that (a) b, f, p, and v become 1 (b) c, g, j, k, q, s, x, and z become 2 (c) d and t both become 3 (d) l (that is, el) becomes 4 (e) m and n become 5 (f) r becomes 6 4. If the result contains two adjacent identical digits, eliminate the second of them. 5. Keep only the first four characters of what you have left. If you have fewer than four, then add zeros on the end to make the string have length four. Write a program that carries out the algorithm. See Fig. 6.86. THIS IS DONE IN VISUAL BASICarrow_forward
- A stopwatch uses six digits to display hours, minutes and seconds. The stopwatch is stopped at 02 : 16 : 58 Write the decimal integers that are currently stored for the Hours, Minutes and Seconds as unsigned binary numbers, using exactly 8 bits. Name the problem that might occur in some programming languages if an attempt was made to store the Minutes value as an unsigned binary number using exactly 4 bits.arrow_forwardthe odd numbers are the numbers in the sequence 1,3,5,7,9, .... Define the sequence of S - numbers as follows: the first S - number is 1 The second S - number is the sum of the first S - number and the second odd number the third s - number is the sum of the second S- number and the third odd number. the fourth S- number is the sum of the third S- number and the fourth odd number, etc..,... compute the first seven S- numbers. make a note of any patterns you notice. enter the first seven S- numbers as a comma - seperated list: first seven S- numbers = ________________arrow_forwardA Palindromic prime is a prime number that is also a palindromic number. Write a C++ program that displays all the palindromic prime numbers between 100 and 999.For example: These are 14 palindromic prime numbers smaller than 500:2,3,5,7,11,101,131,151,181,191,313,353,373,383.arrow_forward
- short answers : c)Give an example of a common floating point arithmetic error due to the particular way in which floating point numbers are stored? d)Give an example of how when using C-strings and the functionstrcpy, things can go wrong.arrow_forwardCorrect answer will be upvoted else Multiple Downvoted. Computer science. You are given two positive integer groupings a1,… ,an and b1,… ,bm. For each j=1,… ,m track down the best normal divisor of a1+bj,… ,an+bj. Input :The primary line contains two integers n and m (1≤n,m≤2⋅105). The subsequent line contains n integers a1,… ,an (1≤ai≤1018). The third line contains m integers b1,… ,bm (1≤bj≤1018). Output :Print m integers. The j-th of them ought to be equivalent to GCD(a1+bj,… ,an+bj).arrow_forwardAn ISBN-10 (International Standard Book Number)consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last digit, d10, is a checksum,which is calculated from the other 9 digits using the following formula:(d1 x 1 + d2 x 2 + d3 x 3 + d4 x 4 + d5 x 5 +d6 x 6 + d7 x 7 + d8 x 8 + d9 x 9),11If the checksum is 10, the last digit is denoted as X according to the ISBN-10convention. Write a program that prompts the user to enter the first 9 digits anddisplays the 10-digit ISBN (including leading zeros). Your program should readthe input as an integer. Here are sample runs: Enter the first 9 digits of an ISBN as integer: 013601267 ↵EnterThe ISBN-10 number is 0136012671arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning