一些c++ 函数以及例子
1.snprintf
int main() { char buf[100]={0} ; int cx; cx = snprintf(buf,sizeof(buf),"the half of %d is %d",60,60/2); snprintf(buf+cx,100-cx,",and a half of that is %d",60/2/2); puts(buf); return 0; }
3.static通俗理解
static变量,与全局变量一样的声明周期,但是想把数据隐藏在类中。
static函数,与全局函数一样可以在全局调用,需要通过类名::调用。