现在的位置: 首页 > 综合 > 正文

while (scanf(“%d”,&n)!=EOF)

2013年03月07日 ⁄ 综合 ⁄ 共 277字 ⁄ 字号 评论关闭
// scanEOF.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
 
int main()   
{   
 int n;
 int array[25];   
 while (scanf("%d",&n)!=EOF)   
 {    
  for (int i=0; i<n; i++)   
   scanf("%d",array+i);   
   for ( i=0; i<n; i++)   
   printf ("%d ",array[i]);   
}  
 printf ("EOF:%d \n",EOF);   
  return 0;   
}
/*
^Z
EOF:-1
Press any key to continue
*/

抱歉!评论已关闭.