How would i save the output of this forloop : This is the code i've already written but i would like to be able to save my for loop output to a file. I have tried using different ways like using ofstream around the loop outside the loop and inside the loop. However even tho using these my code runs it does not output information to the file like i would like. ANY help would be greatly appreciated.

    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    struct alexisgay {
        int number;
        int numbertwo;
    };
    
    void printStruct(alexisgay thestruct);
    
    int main(){
    	alexisgay alex[4] = {{15, 20},{30, 35},{45, 50},{60, 65}};
    	
    	cout<<"Number"<<"\t"<<"Numbertwo"<<endl;
    	
    	int sizeofarray = 4;
    	
    	for(int x = 0; x < sizeofarray; x = x+1){
    	    printStruct(alex[x]);
    	}
    }
    
    void printStruct(alexisgay thestruct){
    	for(int x = 0;x < 1; x++)
    	 if(thestruct.number > 30){
    	  cout<<thestruct.number*10<<"\t"<<thestruct.numbertwo<<endl;}
    	 else if(thestruct.number <= 30){
    	  cout<<thestruct.number*10<<"\t"<<thestruct.numbertwo<<endl;
    	 
    }

