Write a program that takes in three integers as inputs and outputs the largest value. Use a try block to perform all the statements. Use a catch block to catch any ios_base: failure caused by missing inputs and output the number of inputs read and the largest value. Output "No max" if no inputs are read. Note: Because inputs are pre-entered when running a program in the zyLabs environment, the system throws the ios_base: failure when inputs are missing. Test the program by running the program in the Develop mode. Hint: Use a counter to keep track of the number of inputs read and compare the inputs accordingly in the catch block when an exception is caught. Ex: If the input is: 375 the output is: 7 Ex: If the input is: 3 the system throws the ios_base::failure and outputs: 1 input (s) read: Max is 3 Ex: If no inputs are entered: the system throws the ios_base: failure and outputs: 0 input (s) read: No max
Write a program that takes in three integers as inputs and outputs the largest value. Use a try block to perform all the statements. Use a catch block to catch any ios_base: failure caused by missing inputs and output the number of inputs read and the largest value. Output "No max" if no inputs are read. Note: Because inputs are pre-entered when running a program in the zyLabs environment, the system throws the ios_base: failure when inputs are missing. Test the program by running the program in the Develop mode. Hint: Use a counter to keep track of the number of inputs read and compare the inputs accordingly in the catch block when an exception is caught. Ex: If the input is: 375 the output is: 7 Ex: If the input is: 3 the system throws the ios_base::failure and outputs: 1 input (s) read: Max is 3 Ex: If no inputs are entered: the system throws the ios_base: failure and outputs: 0 input (s) read: No max
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
main.cpp
#include <iostream>
using namespace std;
int main() {
cin.exceptions(ios::failbit); // Allow cin to throw exceptions
int val1;
int val2;
int val3;
int max;
val1 = 0;
val2 = 0;
val3 = 0;
/* Type your code here. */
return 0;
}
Please complete this code in C++ thank you.
![T
EGE
29706)
Lesson 4 - Lab Assignment
ST 2362: C++ Programming II home > 14.17: CIS2362 LAB: Input errors with zyLabs
14.17 CIS2362 LAB: Input errors with zyLabs
Write a program that takes in three integers as inputs and outputs the largest value. Use a try block to perform all the statements. Use a
catch block to catch any ios_base::failure caused by missing inputs and output the number of inputs read and the largest value. Output "No
max" if no inputs are read.
Note: Because inputs are pre-entered when running a program in the zyLabs environment, the system throws the ios_base::failure when
inputs are missing. Test the program by running the program in the Develop mode.
Hint: Use a counter to keep track of the number of inputs read and compare the inputs accordingly in the catch block when an exception is
caught.
Ex: If the input is:
375
the output is:
7
Ex: If the input is:
3
the system throws the ios_base::failure and outputs:
1 input (s) read:
Max is 3
Ex: If no inputs are entered:
the system throws the ios_base::failure and outputs:
0 input (s) read:
No max
485840.2632270.qx3zqy7
zyBooks catalog
GTC
Help](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc081ddcc-eba2-40ae-b68f-7408fff0456c%2F0185e351-1422-460f-89c3-3ea22395a714%2F7bi1m1r_processed.png&w=3840&q=75)
Transcribed Image Text:T
EGE
29706)
Lesson 4 - Lab Assignment
ST 2362: C++ Programming II home > 14.17: CIS2362 LAB: Input errors with zyLabs
14.17 CIS2362 LAB: Input errors with zyLabs
Write a program that takes in three integers as inputs and outputs the largest value. Use a try block to perform all the statements. Use a
catch block to catch any ios_base::failure caused by missing inputs and output the number of inputs read and the largest value. Output "No
max" if no inputs are read.
Note: Because inputs are pre-entered when running a program in the zyLabs environment, the system throws the ios_base::failure when
inputs are missing. Test the program by running the program in the Develop mode.
Hint: Use a counter to keep track of the number of inputs read and compare the inputs accordingly in the catch block when an exception is
caught.
Ex: If the input is:
375
the output is:
7
Ex: If the input is:
3
the system throws the ios_base::failure and outputs:
1 input (s) read:
Max is 3
Ex: If no inputs are entered:
the system throws the ios_base::failure and outputs:
0 input (s) read:
No max
485840.2632270.qx3zqy7
zyBooks catalog
GTC
Help
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY