1 #include <stdio.h>
2 int skip(){
3 scanf("%*[^0-9]");
4 return 1;
5 }
6 int main(){
7 int n;
8 while (skip() && scanf("%d", &n)!=EOF)
9 printf("%d\n", n);
10 return 0;
11 }
參考:
1.百度文庫[1]
2.scanf函數的不安全性分析[2]
轉載于:https://www.cnblogs.com/Bird-Xu/p/7847132.html