Command prompt/windows powershell

sir , how do we use cmd /powershell use a .txt file as input for our C++ Program?

@OPPERWEZEN007 I think this solution works for you.

#include
#include
//#define cin fin
//#define cout fout
using namespace std;
int main(){
//ofstream fout(“output.txt”);
//ifstream fin(“input.txt”);
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n;i++){
cout<<arr[i]<<endl;
}
return 0;
}
If you want to use as standard input output then you can use as it is. As per your problem you can use it by only removing two slashes(comments). In the above program “input.txt” is file name for taking input an “output.txt” is the file in which output will be stored.

Note: You only have to provide “input.txt” the program will automatically generate “output.txt”.

You can rename “input.txt” and “output.txt” as per your requirement.

If you are not satisfied with the above solution then you can use a program named hightail. Hightail is an automatic tester for programming contest

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.