摘要: //读取一段文本 并将他们转化为大写字母#include #include #include #include using namespace std;int main(){ vector svec; string sval; //读取一段文本 ... 阅读全文
posted @ 2014-05-04 23:28 庄浩 阅读(135) 评论(0) 推荐(0) 编辑
摘要: //连接多个string对象#include #include using namespace std;int main(){ string str,result_str; //读入多个string对象并进行连接 cout>str) r... 阅读全文
posted @ 2014-05-04 23:23 庄浩 阅读(136) 评论(0) 推荐(0) 编辑
摘要: //读取一组整数到vector 并计算头尾元素的和#include #include using namespace std;int main(){ vector ivec; int ival; //读取整数 cout ::size_type ... 阅读全文
posted @ 2014-05-04 23:10 庄浩 阅读(98) 评论(0) 推荐(0) 编辑
摘要: //读一组整数到vector对象 计算并输出每对相邻元素的和#include #include using namespace std;int main(){ vector ivec; int ival; //读取整数 cout > ival)... 阅读全文
posted @ 2014-05-04 23:08 庄浩 阅读(110) 评论(0) 推荐(0) 编辑
摘要: //去掉string对象中的标点符号#include #include using namespace std;int main(){ string str, result_str; bool has_punct = false; //用于记录有无标点 ... 阅读全文
posted @ 2014-05-04 23:00 庄浩 阅读(172) 评论(0) 推荐(0) 编辑
摘要: //判断两个字符串的大小和长度#include #include using namespace std;int main(){ string s1,s2,msg; string::size_type len1,len2; cout>s1>>s2; ... 阅读全文
posted @ 2014-05-04 22:57 庄浩 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 直接看代码和注释吧。。。//利用指针实现数组的滚动 本例实现数组像右滚动几位#include #include int main(){ int arr[20]; int i,n,offset; //输入数组大小和数组内容 printf("To... 阅读全文
posted @ 2014-05-04 22:54 庄浩 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。现提供正确答案://10个数,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组#include #include int main(){ int number[10]; ... 阅读全文
posted @ 2014-05-04 22:52 庄浩 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 题目:输入3 个数a,b,c,按大小顺序输出。源码:#include #include //利用指针排序三个数 a b cint main(){ void swap(int *,int *); int n1,n2,n3; int *pointer1,... 阅读全文
posted @ 2014-05-04 22:49 庄浩 阅读(182) 评论(0) 推荐(0) 编辑