c/c++语言开发共享如何在使用while loop scanf!= EOF后使用scanf

我必须在我的program.gcc ./”file“<file.in中输入一个.in文件
因为有多个输入我必须使用While循环EOF,但因为我不能再扫描。 这是我的程序的模拟版本。 谢谢

#include  int main() { int arr[100]; int num; int count = 0; while( scanf("%d", &arr[count]) != EOF ) { count++; } printf("%dn", arr[0]); scanf("%d", &num); printf("%dn", num); } 

    试试这个

     freopen("con:", "r", stdin);//this for windows. "/dev/tty" for *nix ? scanf("%d", &num); 

      以上就是c/c++开发分享如何在使用while loop scanf!= EOF后使用scanf相关内容,想了解更多C/C++开发(异常处理)及C/C++游戏开发关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/c-cdevelopment/559609.html

      (1)
      上一篇 2021年1月27日
      下一篇 2021年1月27日

      精彩推荐