UIU: Competitive Programming: File IO


1. Create a file named “in.txt” in same location of your source cpp file

2. Write two integer number in “in.txt” file

for example,
2 5


// @BEGIN_OF_SOURCE_CODE
 
#include <cstdio>
 
using namespace std;
 
int main(int argc, const char * argv[])
{
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
 
    int a, b;
 
    scanf ("%d %d", &a, &b);
 
    printf ("%d\n", a + b);
 
    return 0;
}
 
// @END_OF_SOURCE_CODE

2 thoughts on “UIU: Competitive Programming: File IO

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s