【初心者歓迎】C/C++室 Ver.34【環境依存OK】
■ このスレッドは過去ログ倉庫に格納されています
0273デフォルトの名無しさん
2007/01/28(日) 12:02:42↓こんなことしてみたんですけど、なにがなんだか。
#include <string>
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
string str = "ABC";
cout << str.c_str() << "\n";
cout << str.data() << "\n";
for ( int i = 0 ; (str.c_str())[i] != '\0' ; i++ )
{
cout << (str.c_str())[i] << "\n";
}
for ( int i = 0 ; (str.data())[i] != '\0' ; i++ )
{
cout << (str.data())[i] << "\n";
}
}
■ このスレッドは過去ログ倉庫に格納されています