help with the file input
It is a project of the four fundamental operations of arithmetic can anyone help me to add the file input and output part if the the input file is "in.txt" and the output file is "out.txt" Thankyou #include <iostream> #include <stdio.h> #include <cstdlib> #include <stack> using namespace std ; int main(){ int N ; scanf("%d",&N) ; getchar() ; while(N--){ stack<int> house ; string in ; getline(cin,in) ; int l=in.size(),ok=0,num=0,ten=1 ; for(int i=l-1 ; i>=0 ; i--){ if(in[i]-'0'>=0 && in[i]-'9'<=0){ num+=ten*(in[i]-'0') ; ten*=10 ; ok=1 ; } if(in[i] == ' ' && ok){ house.push(num) ; num=0 ; ok=0 ; ten=1 ; } if(isalpha(in[i])){ int in1=house.top() ; house.pop() ; int in2=house.top() ; house.pop() ; if(in[i] == 'D'){ int in3=in1+in2 ; house.push(in3) ; } else if(in[i] == 'B'){ int in3=in1-in2 ; house.push(in3) ; } else if(in[i] == 'L'){ int in3=in1*in2 ; house.push(in3) ; } else if(in[i] == 'X'){ int in3=max(in1,in2) ; house.push(in3) ; } else if(in[i] == 'N'){ int in3=min(in1,in2) ; house.push(in3) ; } i-=2 ; } } printf("%d\n",house.top()) ; house.pop() ; } return 0 ; }