随笔分类 -  C++ primer ex

C++ primer ex 3.8
摘要:#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 阅读全文

posted @ 2012-10-26 21:12 零风腾飞 阅读(164) 评论(0) 推荐(0)

C++ primer 第3章 ex3.10
摘要:#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 阅读全文

posted @ 2012-10-26 20:57 零风腾飞 阅读(137) 评论(0) 推荐(0)

C++ Primer 第3章ex 3.7
摘要:#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 阅读全文

posted @ 2012-10-25 22:01 零风腾飞 阅读(119) 评论(0) 推荐(0)

C++ Primer 第3章ex3.5
摘要:#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 阅读全文

posted @ 2012-10-25 21:06 零风腾飞 阅读(138) 评论(0) 推荐(0)

导航