Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. short numA, numB, numC, numD;
  5. char input;
  6.  
  7. void readChar()
  8. {
  9.     input = cin.get();
  10. }
  11.  
  12. int main()
  13. {
  14.     cout << "Enter a group of grades: ";
  15.  
  16.     _asm
  17.     {  
  18.     START:
  19.         call readChar;
  20.  
  21.         // if A
  22.         cmp input, 'A';
  23.         Je COUNTA;
  24.         cmp input, 'a';
  25.         Je COUNTA;
  26.        
  27.         // if B
  28.         cmp input, 'B';
  29.         Je COUNTB;
  30.         cmp input, 'b';
  31.         Je COUNTB;
  32.  
  33.         // if C
  34.         cmp input, 'C';
  35.         Je COUNTC;
  36.         cmp input, 'c';
  37.         Je COUNTC;
  38.  
  39.         // if D
  40.         cmp input, 'D';
  41.         Je COUNTD;
  42.         cmp input, 'd';
  43.         Je COUNTD;
  44.  
  45.         // if end
  46.         Jmp END;
  47.  
  48.     COUNTA:
  49.         mov ax, numA;
  50.         inc ax;
  51.         mov numA, ax;
  52.         Jmp START;
  53.  
  54.     COUNTB:
  55.         mov ax, numB;
  56.         inc ax;
  57.         mov numB, ax;
  58.         Jmp START;
  59.  
  60.     COUNTC:
  61.         mov ax, numC;
  62.         inc ax;
  63.         mov numC, ax;
  64.         Jmp START;
  65.  
  66.     COUNTD:
  67.         mov ax, numD;
  68.         inc ax;
  69.         mov numD, ax;
  70.         Jmp START;
  71.  
  72.     END:
  73.     }
  74.     cout << "No. of A's = " << numA << endl;
  75.     cout << "No. of B's = " << numB << endl;
  76.     cout << "No. of C's = " << numC << endl;
  77.     cout << "No. of D's = " << numD << endl;
  78.  
  79.     system("PAUSE");
  80.     return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement