ACM——备忘录

泄露秘密 提交于 2019-12-18 23:44:27

getline,cin,(cin>>x).get();

#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<cmath>
#define debug cout<<"ok"<<endl
typedef long long ll;
const int maxn=1e4+500;
const int mod=1e9+7;
using namespace std;
string s,buf;
int n;
int main()
{
    ios::sync_with_stdio(false);
    (cin>>n).get();//cin>>n会忽略掉换行符而getline遇见换行符会停止所以cin不能配getline要用(cin>>n).get();代替
    getline(cin,s);
    stringstream ss(s);
    while(ss>>buf)
    {
        cout<<buf<<endl;
    }
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!