Created
May 14, 2017 08:33
-
-
Save komasaru/5b5417ac3b16779d49e4365c84413a68 to your computer and use it in GitHub Desktop.
Fortran code to convert chars to uppercase.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!**************************************************** | |
! 英小文字->英大文字 変換 | |
! : 入力文字列の英小文字を全て英大文字に変換して出力する | |
! | |
! date name version | |
! 2017.05.14 mk-mode.com 1.00 新規作成 | |
! | |
! Copyright(C) 2017 mk-mode.com All Rights Reserved. | |
!**************************************************** | |
! | |
program to_uppercase | |
implicit none | |
integer i | |
character(len=100) line | |
print *, "英文を入力してください(100文字超は切り捨て):" | |
read '(a)', line | |
do i = 1, len_trim(line) | |
if (line(i:i) >= 'a' .and. line(i:i) <= 'z') then | |
line(i:i) = char(ichar(line(i:i)) - 32) | |
end if | |
end do | |
print '(a)', trim(line) | |
end program to_uppercase |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment