Example valid/invalid inputs and the expected outputs. -(D or d) to convert binary number to its equivalent decimal -(T or t) to findout wether three numbers wil1 form tringle sides -(Q or a) to Quit Enter you choice D P1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits 10201 arning ...wrong input try again 1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits 10101010 darning ....wrong input try again 1z enetr a positive binary number (base 2 -- l's and e's only) of no more than 6 digits 11001 The equivalent decimal number is 25 for the input binary number 11001 2 - (D or d) to convert binary number to its equivalent decimal -(T or t) to findout wether three numbers wil form tringle sides - (Q or a) to Quit Enter you choice t Plz enter 3 positive numbers in the rangel to 1e0 30 9e see Warning ....wrong input try again Plz enter 3 positive numbers in the rangel to 10e 30 90 se The three input values 30, 90 ,8e can possibly be the three sides of a triangle - (D or d) to convert binary number to its equivalent decimal -(T or t) to findout wether three numbers will form tringle sides - (Q or a) to Quit Enter you choice t Plz enter 3 positive numbers in the rangel to 100 30 10 se The three input values 30 , 1e, se can NOT be the three sides of a triangle Sample of output LOG file. The equivalent decimal number is 25 for the input binary number 11001 The three input values 30 , 90 ,80 can possibly be the three sides of a triangle

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Using c++ program
Example valid/invalid inputs and the expected outputs.
- (D or d) to convert binary number to its equivalent decimal
-(T or t) to findout wether three numbers will form tringle sides
- (Q or a) to Quit
Enter you choice D
P1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits
10201
darning ...wrong input try again
P1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits
101eieie
darning ...wrong input try again
P1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits
11ee1
The equivalent decimal number is 25 for the input binary number 11001
2
- (D or d) to convert binary number to its equivalent decimal
-(T or t) to findout wether three numbers will form tringle sides
- (Q or a) to Quit
Enter you choice t
Plz enter 3 positive numbers in the rangel to 100
30 9e see
Warning ....wrong input try again
Plz enter 3 positive numbers in the rangel to 100
30 90 se
The three input values 3e
, 90 ,80 can possibly be the three sides of a triangle
- (D or d) to convert binary number to its equivalent decimal
-(T or t) to findout wether three numbers will form tringle sides
-(Q or q) to Quit
Enter you choice t
Plz enter 3 positive numbers in the rangel to 100
30 10 se
The three input values 30 , 10 , 50 can NOT be the three sides of a triangle
Sample of output LOG file.
The equivalent decimal number is 25 for the input binary number 11001
The three input values 30 , 90 ,80 can possibly be the three sides of a triangle
The three input values 3e , 10 , 50 can NOT be the three sides of a triangle
Transcribed Image Text:Example valid/invalid inputs and the expected outputs. - (D or d) to convert binary number to its equivalent decimal -(T or t) to findout wether three numbers will form tringle sides - (Q or a) to Quit Enter you choice D P1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits 10201 darning ...wrong input try again P1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits 101eieie darning ...wrong input try again P1z enetr a positive binary number (base 2 -- 1's and e's only) of no more than 6 digits 11ee1 The equivalent decimal number is 25 for the input binary number 11001 2 - (D or d) to convert binary number to its equivalent decimal -(T or t) to findout wether three numbers will form tringle sides - (Q or a) to Quit Enter you choice t Plz enter 3 positive numbers in the rangel to 100 30 9e see Warning ....wrong input try again Plz enter 3 positive numbers in the rangel to 100 30 90 se The three input values 3e , 90 ,80 can possibly be the three sides of a triangle - (D or d) to convert binary number to its equivalent decimal -(T or t) to findout wether three numbers will form tringle sides -(Q or q) to Quit Enter you choice t Plz enter 3 positive numbers in the rangel to 100 30 10 se The three input values 30 , 10 , 50 can NOT be the three sides of a triangle Sample of output LOG file. The equivalent decimal number is 25 for the input binary number 11001 The three input values 30 , 90 ,80 can possibly be the three sides of a triangle The three input values 3e , 10 , 50 can NOT be the three sides of a triangle
Preface
The purpose of this assignment is to practice the use of text files in addition to designing
and using functions to make your programs easier to understand and maintain Your
solution will consist of two parts:
a)
Add Your name, university id and section number
A C++ program file containing your source code: HW3_xxxxx.cpp; where your
b)
own student ID should replace the string "xxxxX". For example, a student with ID 10000
should submit a file called HW3_10000.cpp.
Problem Definition
Your program will be "menu driven". This means that after every completed operation by
your program, the user is presented with a menu of options once again. EVERY menu
will have a "Quit" option that will exit the user completely from your program. Create
your menu options with brief but meaningful labels.
The first option of your program will prompt the user to enter a positive binary number
(base 2 -- l's and O's only) of no more than 6 digits. Read this value as an int type value
and your program must make sure that it is indeed a binary number (only l's and 0's). If it
isn't, then the user is prompted again. If it is binary, then your program is to calculate the
equivalent decimal value (base 10 -- the number system).
MSB
Binary Digit
LSB
28
27
2
25
24
2
22
21
20
256
128
64
32
16
8
4
1
Representation of a binary number
So for example, converting a Binary to Decimal number would be:
Decimal Digit Value 256
128
64
32
16
8
4 2 1
Binary Digit Value 1 0 1 1 0 0 1 0 1
By adding together ALL the decimal number values from right to left at the positions
that are represented by a "I" gives us:(256) + (64) + (32) + (4) + (1) = 35710 or three
hundred and fifty-seven as a decimal number.
The second option of your program will prompt the user to enter 3 positive numbers in
the rangel to 10, and will tell the user whether the three inputs will form the sides of a
triangle. That is, your program is to determine whether or not the three input values can
possibly be the three sides of a triangle. For instance, 3, 4, and 10 cannot be sides of a
triangle because the longest side is greater than the sum of the other two sides (they don't
satisfy the "triangle inequality").
The third option will be Quit.
Maintain a log of outputs to an output.txt file.
Write three functions,
menu_function, this function will display menu options repeatedly, there is no
returned values from this function.
binary_decimal_function, this function will take as input one integer (base 2)
number and return as output its equivalent decimal value.
tringle_function, this function will receive as input three integer positive
numbers in the range 1-10, and determine whether or not the three input
values can possibly be the three sides of a triangle.
Transcribed Image Text:Preface The purpose of this assignment is to practice the use of text files in addition to designing and using functions to make your programs easier to understand and maintain Your solution will consist of two parts: a) Add Your name, university id and section number A C++ program file containing your source code: HW3_xxxxx.cpp; where your b) own student ID should replace the string "xxxxX". For example, a student with ID 10000 should submit a file called HW3_10000.cpp. Problem Definition Your program will be "menu driven". This means that after every completed operation by your program, the user is presented with a menu of options once again. EVERY menu will have a "Quit" option that will exit the user completely from your program. Create your menu options with brief but meaningful labels. The first option of your program will prompt the user to enter a positive binary number (base 2 -- l's and O's only) of no more than 6 digits. Read this value as an int type value and your program must make sure that it is indeed a binary number (only l's and 0's). If it isn't, then the user is prompted again. If it is binary, then your program is to calculate the equivalent decimal value (base 10 -- the number system). MSB Binary Digit LSB 28 27 2 25 24 2 22 21 20 256 128 64 32 16 8 4 1 Representation of a binary number So for example, converting a Binary to Decimal number would be: Decimal Digit Value 256 128 64 32 16 8 4 2 1 Binary Digit Value 1 0 1 1 0 0 1 0 1 By adding together ALL the decimal number values from right to left at the positions that are represented by a "I" gives us:(256) + (64) + (32) + (4) + (1) = 35710 or three hundred and fifty-seven as a decimal number. The second option of your program will prompt the user to enter 3 positive numbers in the rangel to 10, and will tell the user whether the three inputs will form the sides of a triangle. That is, your program is to determine whether or not the three input values can possibly be the three sides of a triangle. For instance, 3, 4, and 10 cannot be sides of a triangle because the longest side is greater than the sum of the other two sides (they don't satisfy the "triangle inequality"). The third option will be Quit. Maintain a log of outputs to an output.txt file. Write three functions, menu_function, this function will display menu options repeatedly, there is no returned values from this function. binary_decimal_function, this function will take as input one integer (base 2) number and return as output its equivalent decimal value. tringle_function, this function will receive as input three integer positive numbers in the range 1-10, and determine whether or not the three input values can possibly be the three sides of a triangle.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education