C++ error
Thank_T_F
这个作者很懒,什么都没留下…
展开
-
error: 'pf' does not name a type
下面这段代码报错error: 'pf' does not name a type#include <iostream>int f(int,int);int (*pf)(int,int);pf=f;int main(){ return 0;}int f(int i,int j){ return i+j;}但是,下面这段代码编译通过#include <iostre...原创 2018-03-13 22:02:51 · 1079 阅读 · 0 评论 -
error: default argument given for parameter 1
class Money {public: Money(float amount, int moneyType); string asString(bool shortVersion=true);private: float amount; int moneyType;};如上图的红色代码。会出现 error: default argument given for param...原创 2018-03-13 22:03:52 · 2859 阅读 · 2 评论 -
warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
char* test3[5]={ "hello word!", "nihaoaa", "woshizuichangde", "yiyiyiyiy", "jijijiji"}; 像这样定义会出现 C++ warning: deprecated conversion from string const...原创 2018-03-13 22:04:33 · 461 阅读 · 0 评论 -
求开平方时遇到的溢出问题。
bool isPerfectSquare(int num) { if(num<2) return true; if(num==2) return false; int mid=0; int j= min(num, 46341); for(int i=1;i<=j;){ mid=(i+j...原创 2018-03-13 22:06:10 · 690 阅读 · 0 评论