在编辑器里码完代码想要测试程序还要 处理输入输出 ,这个比较麻烦。但是 leetcode 的 playground 就已经帮我们完成了这两个步骤,所以有时在编辑器里写完程序后扔到 playground 进行 printf debug 十分方便。

但是有时候会发现有些题的 playground 无法使用,这个就十分让人抓狂。结果错了,还得在源程序加好多东西才能 debug。

今天用无意中用 C++ 的 std::cout << something << std::endl; 发现不使用 playground 控制台原来也可以显示出标准输出的结果。

leetcode playground 无法使用
原来使用 cout 输出,控制台不会显示 stdout 这些结果。我猜会不会是没写 using namespace std 的原因(刚试了下,还真是 XD)。

相关文章:

  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-06-15
  • 2021-11-18
  • 2022-12-23
  • 2021-11-02
猜你喜欢
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-10-11
  • 2022-12-23
相关资源
相似解决方案