设为首页 加入收藏

TOP

C++编程开发基础知识学习(二)
2017-07-20 10:22:48 】 浏览:834
Tags:编程 开发 基础 知识学习
Myclass &my) { m = my.m; n = my.n; cout << "Copy constructor." << endl;559 } void Myclass::print() { cout << "m=" << m << ",n=" << n << endl; } const Myclass& Myclass::operator = (Myclass &my) { m = my.n; n = my.m; return *this; } int main() { Myclass a,b(10,5); Myclass c(b); a.print(); b.print(); c.print(); c = a; c.print(); return 0; }*/ /*#include int main() { try{ cout << "This is try block." << endl; int a,b; cout <<"we want to do /, please input two numbers:"; while(cin >> a >> b){ if(b == 0) { throw b; }cout << "the result is " << a/b << endl; } cout << endl; }catch(int ){ cout << "分母不应该为0." << endl; } cout << "这里是try catch的外面" << endl; return 0; } */ /*int main() { try{ cout << "begin" << endl; cout << "1" << endl; string a; cout << "name: " << endl; cin >> a; if(a != "cathy"){ throw string("Julia is nooooo"); } throw int(112); cout << "2" << endl; }catch(int e) { cout << e << endl; cout << "3" << endl; }catch(string e){ cout << e << endl; cout << "4" << endl; } cout << "end" << endl; return 0; } */ /* int main(){ string str[5] = {"aads","adsfs","ssfsd","sdfs","sdas"}; string *cp[] = {&str[4],&str[3],&str[2],&str[1],&str[0]}; int i = 0; while(i < 5) { cout << *cp[i] << endl; i++; } return 0; }*/ //#include /*#include int main() { vector ivec; ivec.push_back(1); ivec.push_back(2); ivec.push_back(3); ivec.push_back(4); for(vector ::iterator iter = ivec.begin();iter != ivec.end();++iter) { cout << *iter << endl; } return 0; }*/ /* #include #include #include void outputLine(int , const string &, double); int main() { ifstream inClientFile ("E:\\query.txt",ios::in); if( !inClientFile ){ cerr << "File could not be opened" << endl; exit ( EXIT_FAILURE ); } int account; string name; double balance; cout << left << setw(10) << "Account" << setw(13) << "Name" << "Balance" << endl << fixed << showpoint; while(inClientFile >> account >> name >> balance) outputLine (account, name, balance); return 0; } void outputLine(int account , const string & name, double balance){ cout << left << setw(10) << account << setw(13) << name << balance << endl; } */ //#include /*#include using namespace std; int main() { char input[10000]; int n; while(cin >> input) { n = strlen(input); int temp = 1; for(int i = 0,j = n-1;i<=j;++i,--j) { if(input(i) != input[j]) { temp = 0; break; } } if(temp) { cout << "Yes!" << endl; }else{ cout << "No!" << endl; } } return 0; }*/ #include #include using namespace std; int main() { string word; cin >> word; int n = word.length(); int count = 0; for (int i = n - 1; i >= 0; i--) { if (word[i] != 0) { count ++; } else { break; } } cout << count ; return 0; }
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇static 注意事项 下一篇C++自学之路:3.1-简单变量

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目