basic input and output rules for ACM and other OJ Systems 
In the beginning of the ACM, will face a problem of input and output data, ACM input and output data and the usual writing program is not the same. Why is it different? This involves how the evaluation system determines that the program you are submitting is correct. In fact, the evaluation system is the standard input and output data of the program is placed in a text file, the program you submitted will be compiled first, then run, read the data from the input file, and then output the results to a text file, the evaluation system then the standard output file and the program you submitted the results of the output file comparison, To determine whether the program you are submitting is correct or not. Since this is the case, to determine the correctness of the submitted program depends on the system test data, it is not possible to use a set of test data to determine the correctness of the program, need to have a lot of test data, and the international ACM Competition Standard Evaluation System is PC2, it only supports a topic an input data file, An output data file. So it's time to put more than one set of test data in a file, the program must be submitted to the file in a number of input data to produce results.
 
One, enter:
 
1, only a set of test data, this time is the simplest, please see the topic SDUTOJ1000.
 
C Language code:
 
#include < stdio.h > int main () {int A, B, scanf ("%d%d", & A, & B); printf ("%d\n", A + B); return 0; } 
C + + language code:
 
#include < iostream > using namespace std; int main () {int, B, cin >> a >> b; cout << A + b << Endl; return 0;} 
2, there are several sets of test data, until the end of the input file to read, then need to use while (scanf ("%d", &n)!=eof) or while (cin>>n), see the title: SDUTOJ1010.
 
C Language code:
 
#include < stdio.h > int main () {int A, B, while (scanf ("%d%d", & A, & B)! = EOF) printf ("%d\n", A + b); return 0; } 
Description: The scanf function return value is the number of variables read out, such as: scanf ("%d%d", &a, &b); If there is only one integer input, the return value is 1, if there are two integer inputs, the return value is 2, if none, the return value is-1. EOF is a predefined constant, equal to-1.
 
C + + language code:
 
#include < iostream > using namespace std; int main () {int A, B, while (Cin >> a >> b) cout << A + b << Endl; return 0;} 
3, at the beginning of the input of an n, followed by the N group of data, please see the title: SDUTOJ1011.
 
C Language code:
 
#include < stdio.h > int main () {int n,i; int, B, scanf ("%d", & N); for (i = 0; I < N;i + +) {scanf ("%d%d", & A, & B); printf ("%d\n", A + b);} return 0; } 
Or
 
#include < stdio.h > int main () {int n, i; int a, B; scanf ("%d", & N); while (n--) {scanf ("%d%d", & A, & B); printf ("%d\n", A + b);} return 0; } 
C + + code:
 
#include < iostream > using namespace std; int main () {int A, b, N; Cin >> N; while (n--) {cout << a + b << endl;} return 0;} 
4, the input does not indicate how many sets of data, but a special input as the end flag. See title: SDUTOJ1012, this topic is ended with 0 0 for input.
 
C Language code:
 
#include < stdio.h > int main () {int A, B, while (scanf ("%d%d", & A, & B) && (A | | b) printf ("%d\n", A + b);} 
C + + language code: