随笔分类 - C++训练
摘要:#include#include#includeusing namespace std;int main(){ string maxStr,Str1,Str2; int maxNum,Num1,Num2; if(cin>>Str1) Num1=1; maxNum...
阅读全文
摘要:#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...
阅读全文
摘要:#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...
阅读全文
摘要:#include#include#includeusing namespace std;int main(){ vector str={"The is C++ program ","hfh ","","hfdshfisoid"}; for(auto it=str.begin();it!=...
阅读全文
摘要:#include#include#includeusing namespace std;int main(){ string word; vector Str; while(cin>>word) Str.push_back(word); for(auto c:...
阅读全文
摘要:#include#includeusing namespace std;int main(){ string str="atfi,,ie,,,idfi,,,oo"; decltype(str.size()) n=0; for(auto c:str) { if(!ispun...
阅读全文
摘要:#include#includeusing namespace std;int main(){ const string hexdigits="0123456789ABCDEF"; cout>n) { if(n<hexdigits.size()) ...
阅读全文
摘要:点运算符(.):点运算符只能用于类类型的对象,其左侧运算对象必须是一个类类型的对象,右侧运算对象必须是该类型的一个成员名,运算结果为右侧运算对象指定的成员。调用运算符(()):当用点运算符访问一个成员函数时,通常我们是想调用该函数,我们使用调用运算符来调用一个函数,调用运算符是一对圆括号,里面放置实...
阅读全文
摘要:Sales_item.h#ifndef SALES_ITEM_H#define SALES_ITEM_H#include#includeusing namespace std;class Sales_item{ friend ostream& operator>(istream &is,Sal...
阅读全文
摘要:#includeusing namespace std;void count(){ int value; int cnt; int curvalue; if(cin>>curvalue) { cnt=1; while(cin>>value) ...
阅读全文
摘要:#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...
阅读全文

浙公网安备 33010602011771号