Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows 3.1.2 #102

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2


- name: Cache GnuCOBOL
id: cache-gnu-cobol
uses: actions/cache@v3
with:
path: ~\gnucobol-3.2-dev.zip
key: ${{ runner.os }}-gnu-cobol-3.2
path: ~\gnu-cobol-3.1.2.7z
key: ${{ runner.os }}-gnu-cobol-3.1.2

- name: Download GnuCOBOL
if: steps.cache-gnu-cobol.outputs.cache-hit != 'true'
Expand All @@ -46,11 +45,11 @@ jobs:
MaximumRetryCount = 3
RetryIntervalSec = 1
}
Invoke-WebRequest -Uri 'https://ci.appveyor.com/api/projects/GitMensch/gnucobol-3-x-win32-posix/artifacts/gnucobol-3.2-dev-MinGW-binaries%20(debug).zip?job=Environment:%20BUILD_TYPE=MSYS,%20BUILD_BIN=C:\MinGW\msys\1.0\bin' -OutFile ~\gnucobol-3.2-dev.zip @requestOpts
Invoke-WebRequest -Uri 'https://arnoldtrembley.com/GC312-BDB-M64-rename-7z-to-exe.7z' -OutFile ~\gnu-cobol-3.1.2.7z @requestOpts

- name: Extract GnuCOBOL
shell: pwsh
run: Expand-Archive ~\gnucobol-3.2-dev.zip -DestinationPath gnucobol -Force
run: 7z x ~\gnu-cobol-3.1.2.7z -ognucobol

- name: Run tests for all exercises
shell: pwsh
Expand Down
15 changes: 8 additions & 7 deletions exercises/practice/armstrong-numbers/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@

PROCEDURE DIVISION.
ARMSTRONG-NUMBERS.
MOVE 0 TO WS-ARMSTRONG
PERFORM VARYING WS-INDEX FROM 1 BY 1
INITIALIZE WS-ARMSTRONG.
PERFORM VARYING WS-INDEX FROM 1 BY 1
UNTIL WS-INDEX > LENGTH(TRIM(WS-NUMBER))
IF WS-NUMBER (WS-INDEX:1) EQUAL 0
EXIT PERFORM CYCLE
END-IF
MOVE WS-NUMBER (WS-INDEX:1) TO WS-DIGIT
COMPUTE WS-ARMSTRONG =
WS-ARMSTRONG + WS-DIGIT ** LENGTH(TRIM(WS-NUMBER))
END-PERFORM.
END-PERFORM.

IF FUNCTION NUMVAL ( WS-NUMBER ) IS EQUAL TO WS-ARMSTRONG
IF FUNCTION NUMVAL ( WS-NUMBER ) IS EQUAL TO WS-ARMSTRONG
MOVE 1 TO WS-RESULT
ELSE
ELSE
MOVE 0 TO WS-RESULT
END-IF.

DISPLAY WS-ARMSTRONG.
DISPLAY WS-NUMBER.
DISPLAY WS-ARMSTRONG.
DISPLAY WS-NUMBER.
Loading