题解 | #截取字符串#

截取字符串

http://www.nowcoder.com/practice/a30bbc1a0aca4c27b86dd88868de4a4a

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string strIn;
    int n;
    while(cin>>strIn>>n) {
        string strOut;
        for(int i = 0; i < n; i++) {
            strOut += strIn[i];
        }
        cout<<strOut<<endl;
    }
}
全部评论

相关推荐

点赞 评论 收藏
转发
3 收藏 评论
分享
牛客网
牛客企业服务