online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
RECURSIVE SUBROUTINE abilityPointEdit(cc, cs, stPts, dxPts, coPts, inPts, chPts, wiPts, priS) INTEGER :: extraInt CHARACTER(len=20) :: cc, cs, characterSpecies CHARACTER(len=:), ALLOCATABLE :: extraChar INTEGER :: strModifier, dexModifier, conModifier, intModifier, chaModifier, wisModifier CHARACTER :: strModifierC, dexModifierC, conModifierC, intModifierC, chaModifierC, wisModifierC INTEGER :: i, j, selectedScore INTEGER, parameter :: num_class = 12 CHARACTER(len=:), ALLOCATABLE :: selectedScoreMenu REAL :: rNum INTEGER :: rngResult, priS INTEGER :: scoreSelectThing = 0 INTEGER :: stPts, dxPts, coPts, inPts, chPts, wiPts PRINT *, 'assign points to your abilities' ! with your current class/species, you get these boosts PRINT *, 'select a score to edit' WRITE(*, '(A,I0,A)') '1 - strength (', stPts, ')' WRITE(*, '(A,I0,A)') '2 - dexterity (', dxPts, ')' WRITE(*, '(A,I0,A)') '3 - constitution (', coPts, ')' WRITE(*, '(A,I0,A)') '4 - intelligence (', inPts, ')' WRITE(*, '(A,I0,A)') '5 - wisdom (', wiPts, ')' WRITE(*, '(A,I0,A)') '6 - charisma (', chPts, ')' WRITE(*, '(A)') '7 - im feeling lucky' WRITE(*, '(A)') '8 - these numbers look good, continue' READ (*,*) selectedScore IF(selectedScore == 1)THEN selectedScoreMenu = 'strength' ELSE IF(selectedScore == 2)THEN selectedScoreMenu = 'dexterity' ELSE IF(selectedScore == 3)THEN selectedScoreMenu = 'constituion' ELSE IF(selectedScore == 4)THEN selectedScoreMenu = 'intelligence' ELSE IF(selectedScore == 5)THEN selectedScoreMenu = 'wisdom' ELSE IF(selectedScore == 6)THEN selectedScoreMenu = 'charisma' ELSE IF(selectedScore == 7)THEN !randomise !8-15 CALL random_number(rNum) rngResult = INT(rNum * 8) + 8 stPts = rngResult CALL random_number(rNum) rngResult = INT(rNum * 8) + 8 dxPts = rngResult CALL random_number(rNum) rngResult = INT(rNum * 8) + 8 coPts = rngResult CALL random_number(rNum) rngResult = INT(rNum * 8) + 8 inPts = rngResult CALL random_number(rNum) rngResult = INT(rNum * 8) + 8 wiPts = rngResult CALL random_number(rNum) rngResult = INT(rNum * 8) + 8 chPts = rngResult CALL abilityPointEdit(cc, cs, stPts, dxPts, coPts, inPts, chPts, wiPts, priS) ELSE IF(selectedScore == 8)THEN CALL printSheet(cc, cs, stPts, dxPts, coPts, inPts, chPts, wiPts, priS) RETURN END IF IF(priS == 0) THEN PRINT *, 'priS == 0' !debug WRITE(*,'(A,A,A)') 'how many points would you like to assign to your ', selectedScoreMenu, ' ability?' READ (*,*) scoreSelectThing IF(selectedScore == 1)THEN stPts = scoreSelectThing ELSE IF(selectedScore == 2)THEN dxPts = scoreSelectThing ELSE IF(selectedScore == 3)THEN coPts = scoreSelectThing ELSE IF(selectedScore == 4)THEN inPts = scoreSelectThing ELSE IF(selectedScore == 5)THEN wiPts = scoreSelectThing ELSE IF(selectedScore == 6)THEN chPts = scoreSelectThing END IF END IF IF(priS == 1) THEN PRINT *, 'priS == 1, killing' !debug CALL KILL(2, 1) END IF !after printed CALL abilityPointEdit(cc, cs, stPts, dxPts, coPts, inPts, chPts, wiPts, priS) END SUBROUTINE abilityPointEdit !-------------------------------------------------------------------------- SUBROUTINE printSheet(cc, cs, stPts, dxPts, coPts, inPts, chPts, wiPts, priS) INTEGER :: extraInt CHARACTER(len=20) :: cc, cs, characterSpecies CHARACTER(len=:), ALLOCATABLE :: extraChar INTEGER :: strModifier, dexModifier, conModifier, intModifier, chaModifier, wisModifier CHARACTER :: strModifierC, dexModifierC, conModifierC, intModifierC, chaModifierC, wisModifierC INTEGER :: i, j, selectedScore INTEGER, parameter :: num_class = 12 CHARACTER(len=:), ALLOCATABLE :: selectedScoreMenu REAL :: rNum INTEGER :: rngResult, priS INTEGER :: scoreSelectThing = 0 INTEGER :: stPts, dxPts, coPts, inPts, chPts, wiPts PRINT *, ' ' PRINT *, ' ' PRINT *, '------------ character sheet ------------' WRITE(*,'(A,A)') 'class: ', cc WRITE(*,'(A,A)') 'species: ', cs PRINT *, ' ' PRINT *, ' ---ability points--- ' !strength j = 1 !current score counter extraInt = -5 !modifier counter DO n = 1, 11 !PRINT *, 'DB j = ', j, j-1 !PRINT *, 'DB extraInt = ', extraInt !PRINT *, 'DB stPts = ', stPts !PRINT *, 'DB strModifier = ', strModifier IF(stPts == j)THEN !PRINT *, 'DB x marks the spot' strModifier = extraInt END IF IF(stPts == j - 1)THEN !PRINT *, 'DB x marks the spot' strModifier = extraInt END IF j = j + 2 !count up score by 2 extraInt = extraInt + 1 !count up modifier by 1 END DO IF(strModifier > 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'strength: ', stPts, ' (+', strModifier, ')' ELSE IF(strModifier < 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'strength: ', stPts, ' (', strModifier, ')' END IF !dexterity j = 1 !current score counter extraInt = -5 !modifier counter DO n = 1, 11 IF(dxPts == j)THEN dexModifier = extraInt END IF IF(dxPts == j - 1)THEN dexModifier = extraInt END IF j = j + 2 !count up score by 2 extraInt = extraInt + 1 !count up modifier by 1 END DO IF(dexModifier > 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'dexterity: ', dxPts, ' (+', dexModifier, ')' ELSE IF(dexModifier < 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'dexterity: ', dxPts, ' (', dexModifier, ')' END IF !constituion j = 1 !current score counter extraInt = -5 !modifier counter DO n = 1, 11 IF(coPts == j)THEN conModifier = extraInt END IF IF(coPts == j - 1)THEN conModifier = extraInt END IF j = j + 2 !count up score by 2 extraInt = extraInt + 1 !count up modifier by 1 END DO IF(conModifier > 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'constituion: ', coPts, ' (+', conModifier, ')' ELSE IF(conModifier < 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'constituion: ', coPts, ' (', conModifier, ')' END IF !intelligence j = 1 !current score counter extraInt = -5 !modifier counter DO n = 1, 11 IF(inPts == j)THEN intModifier = extraInt END IF IF(inPts == j - 1)THEN intModifier = extraInt END IF j = j + 2 !count up score by 2 extraInt = extraInt + 1 !count up modifier by 1 END DO IF(intModifier > 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'intelligence: ', inPts, ' (+', intModifier, ')' ELSE IF(intModifier < 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'intelligence: ', inPts, ' (', intModifier, ')' END IF !wisdom j = 1 !current score counter extraInt = -5 !modifier counter DO n = 1, 11 IF(wiPts == j)THEN wisModifier = extraInt END IF IF(wiPts == j - 1)THEN wisModifier = extraInt END IF j = j + 2 !count up score by 2 extraInt = extraInt + 1 !count up modifier by 1 END DO IF(wisModifier > 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'wisdom: ', wiPts, ' (+', wisModifier, ')' ELSE IF(wisModifier < 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'wisdom: ', wiPts, ' (', wisModifier, ')' END IF !charisma j = 1 !current score counter extraInt = -5 !modifier counter DO n = 1, 11 IF(chPts == j)THEN chaModifier = extraInt END IF IF(chPts == j - 1)THEN chaModifier = extraInt END IF j = j + 2 !count up score by 2 extraInt = extraInt + 1 !count up modifier by 1 END DO IF(chaModifier > 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'charisma: ', chPts, ' (+', chaModifier, ')' ELSE IF(chaModifier < 0)THEN WRITE(*,'(A,I0,A,I0,A)') 'charisma: ', chPts, ' (', chaModifier, ')' END IF END SUBROUTINE printSheet ! -------------------------------------------------------------------------------------- PROGRAM main IMPLICIT NONE INTEGER :: f, f1, f2, selected6Program, extraVar, g, remainingGuesses, enteredGuess INTEGER :: strModifier, dexModifier, conModifier, intModifier, chaModifier, wisModifier CHARACTER :: strModifierC, dexModifierC, conModifierC, intModifierC, chaModifierC, wisModifierC INTEGER :: rngResult, priS REAL :: rNum INTEGER :: debugMode INTEGER :: selectedDiceRoll, rpsBet INTEGER :: extraInt CHARACTER(len=:), ALLOCATABLE :: extraChar CHARACTER(len=20) :: cc, cs INTEGER :: i, j, selectedScore, scoreSelectThing INTEGER, parameter :: num_class = 12 CHARACTER(len=12), dimension(num_class) :: classes DATA classes /'barbarian', 'bard', 'cleric', 'druid', & 'fighter', 'monk', 'paladin', 'ranger', & 'rogue', 'sorcerer', 'warlock', 'wizard'/ INTEGER, parameter :: num_species = 10 CHARACTER(len=20), dimension(num_species) :: species DATA species /'dragonborn', 'dwarf (expand)', 'elf (expand)', 'half-elf', & 'half-orc', 'halfling (expand)', 'human (expand)', 'rock gnome', & 'tiefling', 'variant aasimar'/ CHARACTER(len=:), ALLOCATABLE :: selectedScoreMenu INTEGER :: stPts, dxPts, coPts, inPts, chPts, wiPts stPts = 0; dxPts = 0; coPts = 0; inPts = 0; chPts = 0; wiPts = 0 priS = 0 PRINT *, 'set priS to 0' PRINT *, 'select your characters class: ' extraInt = 1 DO i = 1, 12 WRITE(*,'(I0,A,A)') extraInt, ' - ', classes(i) extraInt = extraInt + 1 END DO READ (*,*) extraInt IF (extraInt == 1) THEN cc = 'barbarian' ELSE IF (extraInt == 2) THEN cc = 'bard' ELSE IF (extraInt == 3) THEN cc = 'cleric' ELSE IF (extraInt == 4) THEN cc = 'druid' ELSE IF (extraInt == 5) THEN cc = 'fighter' ELSE IF (extraInt == 6) THEN cc = 'monk' ELSE IF (extraInt == 7) THEN cc = 'paladin' ELSE IF (extraInt == 8) THEN cc = 'ranger' ELSE IF (extraInt == 9) THEN cc = 'rogue' ELSE IF (extraInt == 10) THEN cc = 'sorcerer' ELSE IF (extraInt == 11) THEN cc = 'warlock' ELSE IF (extraInt == 12) THEN cc = 'wizard' END IF PRINT *, 'select your characters species: ' extraInt = 1 DO i = 1, 10 WRITE(*,'(I0,A,A)') extraInt, ' - ', species(i) extraInt = extraInt + 1 END DO READ (*,*) extraInt IF (extraInt == 1) THEN cs = 'dragonborn' ELSE IF (extraInt == 2) THEN PRINT *, 'select sub-species' PRINT *, '1 - hill dwarf' PRINT *, '2 - mountain dwarf' READ (*,*) j IF(j == 1) THEN cs = 'hill dwarf' ELSE IF(j == 2) THEN cs = 'mountain dwarf' END IF ELSE IF (extraInt == 3) THEN PRINT *, 'select sub-species' PRINT *, '1 - high elf' PRINT *, '2 - eladrin elf' PRINT *, '3 - wood elf' READ (*,*) j IF(j == 1) THEN cs = 'high elf' ELSE IF(j == 2) THEN cs = 'eladrin elf' ELSE IF(j == 3) THEN cs = 'wood elf' END IF ELSE IF (extraInt == 4) THEN cs = 'half-elf' ELSE IF (extraInt == 5) THEN cs = 'half-orc' ELSE IF (extraInt == 6) THEN PRINT *, 'select sub-species' PRINT *, '1 - lightfoot halfling' PRINT *, '2 - stout halfling' READ (*,*) j IF(j == 1) THEN cs = 'lightfoot halfling' ELSE IF(j == 2) THEN cs = 'stout halfling' END IF ELSE IF (extraInt == 7) THEN PRINT *, 'select sub-species' PRINT *, '1 - human' PRINT *, '2 - variant' READ (*,*) j IF(j == 1) THEN cs = 'human' ELSE IF(j == 2) THEN cs = 'variant' END IF ELSE IF (extraInt == 8) THEN cs = 'rock gnome' ELSE IF (extraInt == 9) THEN cs = 'tiefling' ELSE IF (extraInt == 10) THEN cs = 'variant aasimar' END IF CALL abilityPointEdit(cc, cs, stPts, dxPts, coPts, inPts, chPts, wiPts, priS) ! ------------------------------------------------ END PROGRAM main

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue