Online judge- input&output

my code:-

#include
using namespace std;
int main(){
cout<<"enter no. of inputs ";
int n;
cin>>n;
while(n>0){
int k;
cout<<"enter the no. : ";
cin>>k;
cout<<"square of “<<k<<” is "<<k*k<<endl;
n–;
}
}

my doubt :

I am not able to link the input .txt file
it throws an error.

error message :

PS C:\Users\USER\Documents> .\s6.exe < input6.txt
At line:1 char:10

  • .\s6.exe < input6.txt
  •      ~
    

The ‘<’ operator is reserved for future use.
+ CategoryInfo : ParserError: (:slight_smile: [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RedirectionNotSupported

Hello @prateek_5

To run the command s6.exe < input6.txt use cmd and NOT powershell.

I didn’t understand.

what’s the difference between these two?
I am actually new to programming.

(I am using sublime text for windows.)

Hello @prateek_5

Hold windows button on the keyboard and press R
type cmd
Hit enter
cmd will open

Now go to the location where both the code and desktop files are saved using the cd command
Now run s6.exe < input6.txt
it wiil run.

Difference
They are both command line interfaces but powershell is more powerful.

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.