This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial: K N1 aN1 N2 aN2
引用的定义不多说,直接看做变量的别名就可以了.有一天写着写着代码,突然想到,如果对vector里某个元素设置引用后,将这个元素从vector里删除会怎么样?我思考了下,认为那个元素会被删除,但是引用还是会指向原来的内存,也就是说这里可能会出现安全问题.光想是不行的,所以速度写了个小测试: #include<iostream> #include<vector> class Test{ public: Test() { a = ; } ~Test() { a = ; } int a;
今天看Scott Meyers大师的stl的用法,看到了我前段时间犯的一个错误,发现我写的代码和他提到错误代码几乎一模一样,有关stl容器删除元素的问题,错误的代码如下:std::vector<struct> mFriendList;...std::vector<struct>::iterator iter = mFriendList.begin();for ( ; iter != mFriendList.end(); ++iter){ if (...) mFr