Translate the following C++ program into assembly language:
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
Related questions
Question
PEP/9
Translate the following C++ program into assembly language:
#include <iostream>
using namespace std;
int main() {
char letter;
int countA = 0,
countB = 0,
countC = 0;
cin >> letter;
do {
switch (letter) {
case 'A' : countA++; break;
case 'B' : countB++; break;
case 'C' : countC++; break;
}
cin >> letter;
} while (letter != 'X');
cout << "Number of A's " << countA << endl
<< "Number of B's " << countB << endl
<< "Number of C's " << countC << endl;
return 0;
}
Use local variables (except for messages, of course) and the branch indexed for the switch statement.
![Translate the following C++ program into assembly language:
#include <iostream>
using namespace std;
int main() {
char letter;
int countA = 0,
%3D
countB = 0,
%3D
countC = 0;
cin >> letter;
do {
switch (letter) {
case 'A' : countA++; break;
case 'B' : countB++; break;
case 'C' : countC++; break;
}
cin >> letter;
} while (letter != 'X');
cout << "Number of A's " << countA << endl
<< "Number of B's " << countB << endl
<< "Number of C's " << countC << endl;
return 0;
}
Use local variables (except for messages, of course) and the branch indexed for the switch statement.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F95d13394-6432-4443-8c1f-89264bac6845%2Fca1a6c2a-93b5-4eb7-92d1-7bfe4c57fa57%2F7x7dln_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Translate the following C++ program into assembly language:
#include <iostream>
using namespace std;
int main() {
char letter;
int countA = 0,
%3D
countB = 0,
%3D
countC = 0;
cin >> letter;
do {
switch (letter) {
case 'A' : countA++; break;
case 'B' : countB++; break;
case 'C' : countC++; break;
}
cin >> letter;
} while (letter != 'X');
cout << "Number of A's " << countA << endl
<< "Number of B's " << countB << endl
<< "Number of C's " << countC << endl;
return 0;
}
Use local variables (except for messages, of course) and the branch indexed for the switch statement.
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 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning