Skip to content

Instantly share code, notes, and snippets.

View DSCF-1224's full-sized avatar

DSCF_1224 DSCF-1224

View GitHub Profile
@DSCF-1224
DSCF-1224 / 201910240001.cpp
Last active October 23, 2019 22:07
my handling exceptions for C++
#include <cstdlib>
// for; EXIT_SUCCESS
// for; EXIT_FAILURE
#include <iostream>
// for; std::cerr
#include <string>
// for; std::string
// for; std::string std::literals::string_literals::operator ""s
#include "ver20191023_01.hpp"
@DSCF-1224
DSCF-1224 / 201910222251.jl
Last active October 22, 2019 13:54
trial module of Julia 2019/10/22 version 01
module Mod20191022v01
mutable struct Coordinate{T <: Core.Real}
x::T
y::T
end
function Base.:+(cd1::Coordinate{T}, cd2::Coordinate{T}) where T <: Core.Real
return Coordinate{T}(cd1.x + cd2.x, cd1.y + cd2.y)
end
function exchangeBackslash(path::Core.AbstractString)
return Base.replace(path, '\u005c' => '\u002f')
end
path_raw = Base.readline(Base.stdin)
path_fix = Main.exchangeBackslash(path_raw)
Base.println(Base.stdout, path_fix)
Base.println(Base.stdout, Base.Filesystem.isabspath(path_raw))
@DSCF-1224
DSCF-1224 / 201908181049.f08
Created August 18, 2019 01:49
generate random characters using subroutine `RANDOM_NUMBER`
program hello
use, intrinsic :: iso_fortran_env
implicit none
integer(INT8), parameter :: ichar_a = ichar("a")
integer(INT8), parameter :: ichar_z = ichar("z")
integer(INT8), parameter :: ichar_width_az = ichar_z - ichar_a + 1