str.clear();
#include<iostream> using namespace std; int main() { stringstr; cout<<?Enter some lines about lidihuo and write dot character to finish the sentence?<<?\n?; cout<<?if you want to clear the text, press d?<<?\n?; do{ charch =cin.get(); str+=ch; if(ch==?d?) str.clear(); }while(ch!=?.?); return 0; }
Enter some lines about lidihuo and write dot character to finish the sentence
if you want to clear the text, press d