日常学习函数

静态变量static,只进行一次初始化。

#include<cstring>
#include<iostream>
using namespace std;
int main()
{
    for(int i=0;i<3;i++)
    {
    int static n=5;
    cout<<n<<endl;
    n++;
    }

    return 0;
}

put :5 6 7。
string库:
strtok库函数实现,能实现字符串的分割.

#include<cstring>
#include<iostream>
int main()
{

char str[ ]="This , a sample string OK."
char * p =strtok(str," ,.-");
while(p!=NULL)
{
    cout<<p<<endl;
    p=strtok(NULL," ,.-");
    
 } 
 return 0;
}

put :
This
a
sample
string
OK

全部评论

相关推荐

饿魔:看到在线简历了吧
点赞 评论 收藏
分享
11-28 13:56
已编辑
吉林建筑大学
所有好工作吻上来:最近可能压力比较大吧,面试的时候已经不屑于去说一些违心的话了,今天这场面试我真是没控制住啊,感觉我已经要发火了
实习学到最有价值的工作习...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务