C read 2 個input

請問點樣做到如果得1個input 收到既話,下次個user 再input 時,係x同y都再read過?同埋個program 會係咁read 直至EOF

mycode:
while(scanf("%d%d",&x,&y)!=EOF)
{

}

mycode:
while(scanf("%d,%d",&x,&y)!=EOF)
{

}

加,

TOP

sorry, it doesn't work

TOP

check吓scanf個 return 數

TOP

兩個loop 咪得lo
int read_y = 0;
while (read_y || scanf("%d", &x) != EOF) )
{
if (scanf("%d", &y) != EOF)
{
read_y = 1;
}
}
因為只要讀到y,scan x 就唔會行。
(I program in C++ more than C, so I may make some mistake.)

TOP