OK、文字列が更新されるように、文字列を作成しようとしています。「hello」という文字列があり、「h」「he」「hel」「hell」「hello」のように更新したい
ので、私は持っています:
#include <iostream>
#include <string>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
using namespace std;
int main()
{
system("title game");
system("color 0a");
string sentence = "super string ";
for(int i=1; i<sentence.size(); i++){
cout << sentence.substr(0, i) <<endl;
}
return 0;
}
コードは次のように返されます。
「す」「す」「すぺ」「すーぱー」
明らかに別の行ですが、最後の行を削除すると、文ビルダーが暴走します。「spupsppuepr sttrrtrsubstringsubstring」のようなものが表示されます
THE SAME LINEの文字列を更新できる方法はありますか? (そして完全に破壊しないでください)