This is what I have tried so far. I am pretty sure freopen is getting caught up in the loop somehow. Thank you in advanced for your help! Sorry If I messed up the formatting. Once cin is used once, it doesn't allow for further input and just prints an identical if statement 5 times.
#include <iostream>
using namespace std;
#include <string>
int main(){
    string x;
    string z;
    int y;
    string t;
    for(int i=0; i<6; i++){
        cout<<"name"<<endl;
        cin>>x;
        cout<<"Pokemon name capatalized"<<endl;
        cin>>z;
        cout<<"Pokedex number"<<endl;
        cin>>y;
        cout<<"type"<<endl;
        cin>>t;
       freopen( "file.txt", "a", stdout );
        cout<<"else if(pokename==\""<<x<<"\" || pokename==\""<<z<<"\" || p=="<<y<<")""{cout<<\"This is "<<z<<", \"; "<<t<<"();}"<<endl; 
    }
    return 0;
}
 
    