随笔分类 -  C++训练

摘要:#include#include#includeusing namespace std;int main(){ string maxStr,Str1,Str2; int maxNum,Num1,Num2; if(cin>>Str1) Num1=1; maxNum... 阅读全文
posted @ 2014-08-05 14:25 Jessica程序猿 阅读(681) 评论(1) 推荐(0)
摘要:#include#include#includeusing namespace std;int main(){ int ia[3][4]={ {0,1,2,3}, {4,5,6,7}, {8,9,10,11} }; for(int (*p)[4]=ia;p!=i... 阅读全文
posted @ 2014-08-04 10:50 Jessica程序猿 阅读(255) 评论(0) 推荐(0)
摘要:#include#include#includeusing namespace std;int main(){ vector::size_type i=0; int arr[10]={0,1,2,3,4,5,6,7,8,9}; //使用整型数组初始化一个vector对象 v... 阅读全文
posted @ 2014-08-04 01:32 Jessica程序猿 阅读(376) 评论(0) 推荐(0)
摘要:#include#include#includeusing namespace std;int main(){ vector str={"The is C++ program ","hfh ","","hfdshfisoid"}; for(auto it=str.begin();it!=... 阅读全文
posted @ 2014-08-03 15:37 Jessica程序猿 阅读(293) 评论(0) 推荐(0)
摘要:#include#include#includeusing namespace std;int main(){ string word; vector Str; while(cin>>word) Str.push_back(word); for(auto c:... 阅读全文
posted @ 2014-08-03 11:48 Jessica程序猿 阅读(1503) 评论(4) 推荐(0)
摘要:#include#includeusing namespace std;int main(){ string str="atfi,,ie,,,idfi,,,oo"; decltype(str.size()) n=0; for(auto c:str) { if(!ispun... 阅读全文
posted @ 2014-08-02 23:09 Jessica程序猿 阅读(978) 评论(0) 推荐(0)
摘要:#include#includeusing namespace std;int main(){ const string hexdigits="0123456789ABCDEF"; cout>n) { if(n<hexdigits.size()) ... 阅读全文
posted @ 2014-08-02 22:47 Jessica程序猿 阅读(356) 评论(0) 推荐(0)
摘要:点运算符(.):点运算符只能用于类类型的对象,其左侧运算对象必须是一个类类型的对象,右侧运算对象必须是该类型的一个成员名,运算结果为右侧运算对象指定的成员。调用运算符(()):当用点运算符访问一个成员函数时,通常我们是想调用该函数,我们使用调用运算符来调用一个函数,调用运算符是一对圆括号,里面放置实... 阅读全文
posted @ 2014-07-31 09:10 Jessica程序猿 阅读(225) 评论(0) 推荐(0)
摘要:Sales_item.h#ifndef SALES_ITEM_H#define SALES_ITEM_H#include#includeusing namespace std;class Sales_item{ friend ostream& operator>(istream &is,Sal... 阅读全文
posted @ 2014-07-31 08:53 Jessica程序猿 阅读(437) 评论(0) 推荐(0)
摘要:#includeusing namespace std;void count(){ int value; int cnt; int curvalue; if(cin>>curvalue) { cnt=1; while(cin>>value) ... 阅读全文
posted @ 2014-07-30 18:32 Jessica程序猿 阅读(379) 评论(0) 推荐(0)
摘要:#includeusing namespace std;int secondMax(int arr[],int n){ int max1,max2; int i; max1=max2=0; for(i=0;i<n;i++) { if(arr[i]<max2... 阅读全文
posted @ 2014-07-30 15:45 Jessica程序猿 阅读(238) 评论(0) 推荐(0)