??freopen??????????????????????????壬???м??滻?????????????á?
????#include <stdio.h> // ???????з???freopen???????iostream.h?У?C++????#include <iostream.h>???ɡ?
????int main()
????{
????freopen("sample.in"?? "r"?? stdin);
????freopen("sample.out"?? "w"?? stdout);
????/* ????????????? */
????fclose(stdin);
????fclose(stdout);
????return 0;
????}
?????????????acm????????????????????????????????????????VC ????????г???????????????????????????н???????????????oj?С????????????????????γ?????????????????????????????????????????д??????????????????????????????????????
???????freopen?????????????????????????????????????????????????Ч??????????
????????????freopen
??????????FILE *freopen( const char *path?? const char *mode?? FILE *stream );
????????????? stdio.h
?????????????
????path: ???????????洢?????????????????????
????mode: ?????????????fopen?е???????r-????? w-д???????
????stream: ???????????????????????
???????????????????????path?????????????????????NULL????????????????????????
??????????????????????????????????????path?????????С????????????????stdin??stdout??stderr??????stdin?????????????????????stdout????????????????????stderr??????????????????????????
????????????VC?μ???“????a+b”??????????
C????
#include <stdio.h>
int main()
{
int a??b;
freopen("debug\in.txt"??"r"??stdin); //????????????????????in.txt????ж??
freopen("debug\out.txt"??"w"??stdout); //??????????????????????out.txt?????
while(scanf("%d %d"??&a??&b)!=EOF)
printf("%d "??a+b);
fclose(stdin);//??????
fclose(stdout);//??????
return 0;
}
C++??
#include <stdio.h>
#include <iostream.h>
int main()
{
int a??b;
freopen("debug\in.txt"??"r"??stdin); //????????????????????in.txt????ж??
freopen("debug\out.txt"??"w"??stdout); //??????????????????????out.txt?????
while(cin>>a>>b)
cout<<a+b<<endl; // ??????endl
fclose(stdin);//??????
fclose(stdout);//??????
return 0;
}