Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- short numA, numB, numC, numD;
- char input;
- void readChar()
- {
- input = cin.get();
- }
- int main()
- {
- cout << "Enter a group of grades: ";
- _asm
- {
- START:
- call readChar;
- // if A
- cmp input, 'A';
- Je COUNTA;
- cmp input, 'a';
- Je COUNTA;
- // if B
- cmp input, 'B';
- Je COUNTB;
- cmp input, 'b';
- Je COUNTB;
- // if C
- cmp input, 'C';
- Je COUNTC;
- cmp input, 'c';
- Je COUNTC;
- // if D
- cmp input, 'D';
- Je COUNTD;
- cmp input, 'd';
- Je COUNTD;
- // if end
- Jmp END;
- COUNTA:
- mov ax, numA;
- inc ax;
- mov numA, ax;
- Jmp START;
- COUNTB:
- mov ax, numB;
- inc ax;
- mov numB, ax;
- Jmp START;
- COUNTC:
- mov ax, numC;
- inc ax;
- mov numC, ax;
- Jmp START;
- COUNTD:
- mov ax, numD;
- inc ax;
- mov numD, ax;
- Jmp START;
- END:
- }
- cout << "No. of A's = " << numA << endl;
- cout << "No. of B's = " << numB << endl;
- cout << "No. of C's = " << numC << endl;
- cout << "No. of D's = " << numD << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement