Hello,
I want my program to take input from a file rather than from keyboard and also output it to a file not screen. I tried writing prgram. This is what I wrote in visual studio...
- #include<iostream>
- #include<conio.h>
- #include<stdio.h>
- using namespace std;
- void main()
- {
- freopen("Document.in" ,"r",stdin);
- freopen("b","w",stdout);
- int x;
- cin>>x;
- cout<<x<<endl;
- getch();
- }
But when I run the program nothing happens. I also tried to only take input from file and output it to screen. Then also it gave garbage value.