首页 > 代码库 > EOF

EOF

标准c

 

 

#include <stdio.h>

int main(int argc, char *argv[])

{

  long  int x;

    while(scanf("%ld",&x)!=EOF)        // while(scanf("%ld",&x)==1)

    {

        printf("%d\n",x*x);   

  }    

return 0;

}

 

 

 

 

 

 

 

 

 

#include <stdio.h>

int main(int argc, char *argv[])

{

 

       int x ,y;    

while(scanf("%d%d",&x,&y)!=EOF)     // while(scanf("%d%d",&x,&y)==2)

    {           

                   printf("%d\n",x-y);  

                                       }   

  return 0;

}

 

 

 

 

 

 

*********************************************

 

C++

 

 

#include <iostream>
using namespace std;
int main()
{
long int x;
while(cin>>x)
cout<<   x*x <<endl; 
 return 0;
}