怎样跳过空格?

P7869 「Wdoi-4」使用三个系统程度的能力

`getline(cin,a);`
by mango09 @ 2021-09-21 09:09:30


@[洋本羊](/user/292069) ```cpp #include <bits/stdc++.h> using namespace std; int main() { string a; getline(cin, a); int len = a.length(); for(int i = 0; i < len; i++) { if(int(a[i]) == 92 && a[i + 1] == 'r' && int(a[i + 2]) == 92 && a[i + 3] == 'n') { cout << "windows"; break; } else if(int(a[i]) == 92 && a[i + 1] == 'r') { cout << "mac"; break; } else if(int(a[i]) == 92 && a[i + 1] == 'n') { cout << "linux"; break; } } return 0; } ```
by Miracle_ZX @ 2021-09-21 09:09:52


``` while((ch=getchar())!=EOF) ```
by BqtMtsZDnlpsT @ 2021-09-21 09:16:50


```cpp #include <bits/stdc++.h> #define R register #define inl inline #define fastios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); #define Debug(file) freopen(file".in","r",stdin);freopen(file".out","w",stdout); using namespace std; const char *s[3] = {"linux", "windows", "mac"}; int type; int main() { fastios; string a; getline(cin, a); if (a.find("\\r\\n") != -1) type = 1; else if (a.find("\\n") != -1) type = 0; else if (a.find("\\r") != -1) type = 2; cout << s[type] << endl; return 0; } ```
by dingshengyang @ 2021-09-21 09:22:55


```cpp string s; while(cin>>s) { } ```
by POYE @ 2021-09-21 09:24:45


`getline(cin,your_str_name)`
by int32 @ 2021-09-21 09:26:03


@[dingshengyang](/user/302394) 乱用梗小鬼![](//图.tk/j)
by haraki @ 2021-09-21 10:42:37


写一个死循环,把代码套进去,然后输出后写return 0;
by Stonkin @ 2021-10-04 15:23:04


|