Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include using namespace std; int main() { int input; cout cin >> input; switch (input) { // Complete this switch statement in C++ }
#include
#include
using namespace std;
int main() {
int input;
cout
cin >> input;
switch (input) {
// Complete this switch statement in C++
}
return 0;
}
You will write a program that uses a switch statement. First, have the user enter an integer as prompted below. If the number is 0 1, or 2 you should printNumber less than three if the number entered is , you should print "Number is three". If the number is 4,5, or 6, you should print "Number between three and seven If the number entered is 7 you should print, "Number is seven". For any other integer input your program should print, "Number outside of range", You should use as few cout statements as possible by carefully ordering your case statements within the switch and thinking about where to put "break" statemens, The Number outside of range cout statement should be in the default case of the switch statement. 1 point will be deducted for not using default properly, and 2 points will be deducted for having multiple cout statements that print the same thing. You must use a switch statement and will receive no credit if you use an if/else construct. Note that part of the code is started for you already Sample run 1 Enter a number 1ess than 8:1 Number less than three Sample run 2: Enter a number less than 8: 7 Number is seven
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started