While loop with two conditions joined by an AND operator in HLA. Converting C++ to HLA

I want to translate (or manually compile) my program from c++ into HLA. The program reads an inputted number. Then subtracting off three and tens or only tens, determine if that value ends in a zero or a three. Three such numbers in a row win the game! One value that does not end in those numbers lose the game.

I don't know how can I do a while loop with two conditions joined by an AND operator in HLA.

while ((iend != 1) && (iscore < 3))

This is the full code I wrote in C++ and I want to translate it to HLA:

#include <iostream>
using namespace std;

int main() {
  int inum;
  int iend = 0;
  int iscore = 0;
  int icheckthree; //To check if it ends in 3
  int icheckzero; //To check if it ends in zero

  while ((iend != 1) && (iscore < 3)) {
    cout << "Gimme a number: ";
    cin >> inum;

    //Case 1: ends in three
    icheckthree = inum - 3;
    while (icheckthree > 0) {
      icheckthree = icheckthree - 10;
      if (icheckthree == 0) {
        cout << "It ends in three!" << endl;
        iscore++;
      }
    }

    icheckzero = inum;
    while (icheckzero > 0) {
      icheckzero = icheckzero - 10;
    }
    //Case 2: ends in zero
    if (icheckzero == 0) {
      cout << "It ends in zero!" << endl;
      iscore++;
    }
    //Case 3: Loose the game
    else {
      if (icheckzero != 0) {
        if(icheckthree != 0) {
          iend = 1;
        }
      }
    }
    
    if (iend == 1) {
      cout << "\n";
      cout << "Sorry Charlie!  You lose the game!" << endl;
    }
    else if (iscore == 3) {
      cout << "\n";
      cout << "You Win The Game!" << endl;
    } else {
      cout << "Keep going..." << endl;
      cout << "\n";
    }
  }
}


from Recent Questions - Stack Overflow https://ift.tt/3EbCwQ6
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)