CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    20

    array size in c++

    i am new in c++

    but
    i hv a project 2 submit.

    their condition was to create template class named xyz in c++ dat can perform array operation of unlimited size.

    u cn create array larger den physical memeory space.data will be cached into a file n retrived 4m d file when needed.

    4 example
    class xyz<int>x=new xyz<int>(1000000000);
    like dat.

    plz do do so send me d code.
    i need code.
    plz help me.

  2. #2
    Join Date
    Feb 2005
    Location
    Normandy in France
    Posts
    4,590

    Re: array size in c++

    It is a complex task for a beginner.
    So, i suppose you should write a simple (but not optimal) version.
    Just use filebuf.
    I hope that with your compiler, filebuf:os_type is 64 bits.
    Last edited by SuperKoko; July 30th, 2005 at 05:30 AM.

  3. #3
    Join Date
    Jul 2005
    Posts
    20

    Re: array size in c++

    #include <iostream.h>
    #include <fstream.h>
    #include <windows.h>
    //namespace std {} // trick BC++ 5.0 which don't use namespace std for iostreams.
    //using namespace std;

    const int c=10000;


    int main()
    {
    //DWORD t0=GetTickCount(); // get the time
    fstream fw;
    //SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS);

    const long int size=10000000;
    fw.open("ss.txt",ios:ut);
    for(unsigned i=1;i<=size;++i)
    fw<<i<<' ';
    fw.close();
    //DWORD t1=GetTickCount();
    //cout<<(t1-t0); // outputs the time (in milliseconds) needed to output!
    return 0;
    }


    tnx 4 ur submission .i hv cnged a little bit.
    but by this code i hv to do d following things.
    so i hv design it with template n overloading of array[].

    i hv 2 randomly access of dat file.to keep speed i hv 2 use memory buffer which will operate as a window 4 d file array.
    after writing d code as above i hv 2 test it with

    f(x)=sine(x)[for d waveform at .0001 intervals]
    f[y]=cos(y)[for d waveform at .0001 intervals]
    n den hv to multiply element by element
    plz help me by sending code or any other way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured