摘要:#include <string>
#include <iostream> using namespace std; void connstring()
{ cout<<"请输入字符串(#结束):"<<endl; string resultStr,userInputStr; while(cin>>userInputStr) { if (!userInputStr.compare("#")) { break; } resultStr+=userInputStr; } cout<<&qu
阅读全文
摘要:#pragma once
#include <string>
#include <iostream>
#include <cctype>
using namespace std; void getstring()
{ string result_str,userInput_str; bool hasPunct=false; cout<<"请输入字符传:"<<endl; cin>>userInput_str; for(string::size_type i=0;i<userInput_str.siz
阅读全文
摘要:#include <string>
#include <iostream>
using namespace std;
void compareStr();
void compareStrSize();
int main()
{ while(true) { cout << endl << "1) 测试两个string对象是否相等" << endl; cout << "2) 测试两个string对象的长度是否相等" << endl; cout << "3
阅读全文
摘要:#include <string>
#include <iostream>
using namespace std;
void getInputLine();
void getInputWord();
int main()
{ while(true) { cout << endl << "1) 每次从标准输入中读入一行文本" << endl; cout << "2) 每次从标准输入中读入一个单词" << endl; cout << "3) 退出&qu
阅读全文