Exercise 4            Name       _____________________    Points ___/21

Translate the following from C++ fragments to corresponding structured Assembly. Assume that eAX is a normal register definitions, i , j and sum are defined as  double words. Use ReadDec, ReadInt, WriteDec, and WriteInt for input and output.

1. (3)    if (i != eAx) {
            eAx--;
            cout << eAx;
          }
 
 
 
 

2. (5)    if (i eAx) {
            eAx++;
            cout << eAx;
          }
          else {
            eAx = eAX * 2;
            cout << eAx;
          }
 
 
 

3. (3)    while (eAx != 1) {
            eAx = eAx / eCx;
            cout << eAx;
          }
 
 
 
 

4. (5)    for (i=0; i<5; i++)
            for (j=10; j>0; j--) {
                eAx = i*j;
                cout << eAx;
            }
 
 
 
 
 
 

5. (5)    product = 1;
          do {
            cin >> eAx;
            if (eAx ≤ 0)
                eAx = -eAx;
            product = product * eAx;
          while (eAx = 0);


Document last modified: