while(scanf(“%d%d”,&a,&b)!=EOF)循环无法退出问题

来源:互联网 发布:php钩子是什么意思 编辑:程序博客网 时间:2024/05/17 03:34

今天在刷PATB1010时遇到的问题,代码如下

#include<cstdio>  #include<iostream>  using namespace std;    int main() {      int a, b, count = 0;      int a1[100], b1[100];      while (scanf("%d%d", &a, &b)!=EOF) {            if (a &&b) {              a1[count] = a*b;              b1[count] = b - 1;              count++;          }     }      if (!count) {          cout << "0 0";          return 0;      }      else {          for (int i = 0;i < count-1; i++)              cout << a1[i] << " " << b1[i] << " ";          cout << a1[count - 1] << " " << b1[count - 1];      }      return 0;  }  



问题是分分钟就过了评测点,但自己用vs调试的时候就是无法跳出循环,新行下Ctrl+Z+Enter输入EOF试了,F6+Enter*2也试了,就是跳不出循环,搞得最后都没有个结果

不知啥时候能找到原因,先在这占个坑


原创粉丝点击