int main()
{
    int n=10;

    cout<<"Enter the value of n:";
    cin>>n;
    int i=0;

    ifstream file("C:\\Users\\kvb\\Desktop\\sample.txt");
    string line;
    string buffer[n];
    if(file.is_open())
    {
        while(file.good())
        {
            getline(file,line);
            buffer[i++%n]=line;
        }
        file.close();
    }
    for(int j=i%n;j<n;j++)
    {
        cout<<buffer[j]<<endl;
    }
    for(int j=0;j<i%n;j++)
    {
        cout<<buffer[j]<<endl;
    }
    return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to