Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program anticheat
- implicit none
- character(len=20) :: cheats(3) = ['cheat1', 'cheat2', 'cheat3']
- character(len=20) :: input
- logical :: isCheating
- ! Prompt the user for input
- write(*,'(A)') 'Enter a command: '
- read(*,'(A)') input
- ! Check if the user is cheating
- isCheating = .false.
- do i = 1, 3
- if (index(input, cheats(i)).ne.0) then
- isCheating = .true.
- exit
- end if
- end do
- ! If the user is cheating, display a message and exit the program
- if (isCheating) then
- write(*,'(A)') 'Cheating is not allowed!'
- stop
- end if
- ! If the user is not cheating, continue with the program
- write(*,'(A)') 'Valid input'
- end program anticheat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement