Write a C++ program that reads user's choice as single character then do the following: • If the user entered (A), your program should read a long positive number, and display the positive difference between the first and last digits (the positive difference between the most right digit and the most left digit) i.e. If the number is 5635634, the program should display 1 (5-4=1). If the number is 3635637, the program should display 4 (7-3=4). • If the user entered (B), your program should read 9 integer numbers, then find and print the sum of the odd numbers. • If the user entered (C), your program should read two integer numbers, add three to each of them, swap their values, and print them after swapping. • If the user entered any other character as a choice, then your program should display the following pattern.

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
icon
Concept explainers
Question
+
x Online C++ Compiler - online ed +
X Menu Path2Code
x (1) WhatsApp
x Second Semester 2021: al
path2code.com/p2c/suser/question/read.php?testid=tv816K2r1315sFiP8hfhXepWziksjMuOaTE943AZ.FY-&qid=3KmKN94Igy2S2UV2nv7psw-- A
upa
54321
4321
321
21
S Raise Your hand!
Code A</> Path2Code
A main.cpp
1 #include<iostream>
2 using namespace std;
3 int main() {
return 0;
OB Custom input? O Run
1 Submit
Path2Code.com © 2021 All rights reserved.
03:46P
EN
) ll a
Transcribed Image Text:+ x Online C++ Compiler - online ed + X Menu Path2Code x (1) WhatsApp x Second Semester 2021: al path2code.com/p2c/suser/question/read.php?testid=tv816K2r1315sFiP8hfhXepWziksjMuOaTE943AZ.FY-&qid=3KmKN94Igy2S2UV2nv7psw-- A upa 54321 4321 321 21 S Raise Your hand! Code A</> Path2Code A main.cpp 1 #include<iostream> 2 using namespace std; 3 int main() { return 0; OB Custom input? O Run 1 Submit Path2Code.com © 2021 All rights reserved. 03:46P EN ) ll a
+
x Online C++ Compiler - online ed +
X Menu Path2Code
x (1) WhatsApp
x Second Semester 2021: al
نافذة ضيف
path2code.com/p2c/suser/question/read.php?testid=tv816K2r1315sFiP8hfhXepWziksjMuOaTE943AZ.FY-&qid=3KmKN94Igy2S2UV2nv7psw-- A
O Challenge task
Write a C++ program that reads user's choice as single character then do the following:
• If the user entered (A), your program should read a long positive number, and display the positive difference between the first and last digits
(the positive difference between the most right digit and the most left digit)
i.e.
If the number is 5635634, the program should display 1 (5-4-1).
If the number is 3635637, the program should display 4 (7-3=4).
• If the user entered (B), your program should read 9 integer numbers, then find and print the sum of the odd numbers.
• If the user entered (C), your program should read two integer numbers, add three to each of them, swap their values, and print them after
swapping.
• If the user entered any other character as a choice, then your program should display the following pattern.
54321
4321
321
21
1
Constraints
03:46
EN
4)all餅a
000
Transcribed Image Text:+ x Online C++ Compiler - online ed + X Menu Path2Code x (1) WhatsApp x Second Semester 2021: al نافذة ضيف path2code.com/p2c/suser/question/read.php?testid=tv816K2r1315sFiP8hfhXepWziksjMuOaTE943AZ.FY-&qid=3KmKN94Igy2S2UV2nv7psw-- A O Challenge task Write a C++ program that reads user's choice as single character then do the following: • If the user entered (A), your program should read a long positive number, and display the positive difference between the first and last digits (the positive difference between the most right digit and the most left digit) i.e. If the number is 5635634, the program should display 1 (5-4-1). If the number is 3635637, the program should display 4 (7-3=4). • If the user entered (B), your program should read 9 integer numbers, then find and print the sum of the odd numbers. • If the user entered (C), your program should read two integer numbers, add three to each of them, swap their values, and print them after swapping. • If the user entered any other character as a choice, then your program should display the following pattern. 54321 4321 321 21 1 Constraints 03:46 EN 4)all餅a 000
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Control Structure
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.
Similar questions
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