关了同步流你就不能用getchar了啊
你快读都写了为啥不写个函数读取那个str呢
by __世界第一弱__ @ 2019-10-31 16:41:22
可能关闭流同步导致$getchar$炸了?
by 查无此人 @ 2019-10-31 16:42:24
```cpp
ios::sync_with_stdio(0);
```
这句话是关闭和stdin的同步,也就是iostream不能和stdin混用了,getchar是stdin的,混用就出问题了。
可以试试cin.getchar()。
by hly1204 @ 2019-10-31 16:43:45
@[bingoyes](/space/show?uid=116772) @[查无此人](/space/show?uid=88583) IO流同步关了iostream和stdio不同步,就只能用cin,不然可能出bug
by __世界第一弱__ @ 2019-10-31 16:45:38
@[hly1204](/space/show?uid=242973)
@[查无此人](/space/show?uid=88583)
@[__世界第一弱__](/space/show?uid=24397)
谢
by bingoyes @ 2019-10-31 16:47:21
iostream也有处理raw的数据的。。也就是未格式化IO,速度也很快。详细可以去查一下。
例如
```cpp
int ch;
is.get(ch);
os.put(ch);
ch=is.get();
is.putback(ch);
is.unget();
ch=is.peek();
```
by hly1204 @ 2019-10-31 16:49:03