ちゃっくのメモ帳

ちゃっくがメモしときたいことをメモしとくよ

2016-02-15から1日間の記事一覧

暇だったからSICPの1章の何問かをHaskellで解いてみたんだよっ

春休みに入って暇だったからSICPを眺めてて問題を幾つかHaskellの練習がてら解いてみた問題1.3 square x = x * x sum_of_square x y = (square x) + (square y) prob1_3 x y z | x <= y && x <= z = sum_of_square y z | y <= z && y <= x = sum_of_square x…

stringstreamを使ってみたんだよ

C++

C++でstringstreamを使ってみた。 空白区切り 何がしたかったかというとC++で空白区切りの文字列を処理したかった。 しかし、C++にはsplit関数がない。そこでstringstreamが使えるらしい。 ソースコード #include <iostream> #include <string> #include <sstream> using namespace std;</sstream></string></iostream>…