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.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning