selectMenu :: Int->IO()
selectMenu num
|(num==2)=convertBinToDecimal
convertBinToDecimal:: IO()
convertBinToDecimal= do
putStrLn("\n\tConvert Binary To Decimal\n")
putStrLn("----------------------------------------------------------\n")
putStrLn("Enter 5 binary numbers [,,] : ")
input<-getLine
let n=(read input)::Int
--putStrLn (show n)
let result = convertionTO binaryToDec n
putStrLn(show result)
이 코드는 괜찮은 것처럼 보이지만 오류가 있습니다.바이너리를 십진수로 변환
이 오류를 수정하는 방법은 무엇입니까? 당신은 Int
입니다 x
에 reverse
를 사용하려는
'putStrLn ("Foo")'라고 쓰는 방법은 다소 이상합니다. 'x'에 적용된 함수'f'를'fx'로 작성하는 것이 훨씬 더 일반적입니다. 그래서'putStrLn "Foo"'는 훨씬 더 자연 스럽습니다. – gspr
감사합니다. 나는 그것을 바꿀 것이다 ... 다시 고마워한다 – JJ23