掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
文字からASCIIコードを取得するには (ID:70230)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
#include "stdafx.h" #include <iostream> #include <numeric> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string str = "AB"; int sum = accumulate(str.begin(), str.end(), 0); cout << sum << endl; //------------------- // 牛刀を使わずとも初心者向きには // こちらがよいのではと思います。 int chi1=str.at(0); int chi2=str.at(1); sum=chi1+chi2; cout << sum << endl; return 0; }
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.