User Profile

Collapse

Profile Sidebar

Collapse
tdlr
tdlr
Last Activity: Jul 26 '11, 08:47 PM
Joined: Jan 2 '11
Location: Th, Germany
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • You need to use a 64 Bit OS and a 64bit compatible compiler because 32 bit porgrams/os's are only able to address 4gb of memory including graphics memory and others, which leaves around 3gb of addressable RAM. So I believe that the real problem is you using a 32 bit system.

    edit: woops, 2 minutes too slow ;)
    See more | Go to post

    Leave a comment:


  • tdlr
    replied to Validate a leap year
    in C
    Attention!
    There are exceptions to the 4 years rule: If a year modulo 4 is 0 it is a leap year, except if the year modulo 100 is 0, but then again if the year modulo 400 is 0!
    1900 was not a leap year (not divisible by 400), 2000 was one (divisible by 400).
    See more | Go to post

    Leave a comment:


  • Code:
    Thanks also what is the conversion type four a double to output the value for a printf statement,as I would like to show what the value of M3 is;
    You can find this information in every online cpp reference. If you don't know any, look here: Post by Banfa

    This time, here it is:
    %.<precision>f
    %.4f would print the double with 4 characters after the decimal dot.
    See more | Go to post

    Leave a comment:


  • Yes, this works.

    But if the dimension is always 6, you could define a const integer somewhere in your code which stores all the matrices dimensions.
    See more | Go to post

    Leave a comment:


  • If they are always 6x6, use 6.
    If not, use the same dimension that the two matrices M1 and M2 have. In the latter case, also set the dimension of M3 properly.
    See more | Go to post

    Leave a comment:


  • Code:
    int MatrixAdd(double M1[6][6], double M2[6][6])
    /* Addition of Matrix*/
    {
    double M3[6][6];
    int m,n; //Define m and n
    int i,j,k;
    
    for(i=0;i<m;i++) // Use m without initialization
    {
    for(j=0;j<n;j++) // Use n without initialization
    M3[i][j]=M1[i][j]+ M2[i][j];
    }
    }
    See more | Go to post

    Leave a comment:


  • You cannot use % with double. Change totalPounds to an integer type like long.
    See more | Go to post

    Leave a comment:


  • tdlr
    replied to How to store grid layout in array?
    in C
    If I understood correctly, you want to save the current row setup of the game to modify it or to transfer it to somewhere else.
    For a single row, you could use a std string:
    Code:
    #include <string>
    #include <iostream>
    
    string row;
    	row.append(".");
    	cout<<"row is now: "<<row<<endl;
    	row[0] = '+';
    	cout<<"row is now: "<<row<<endl;
    ...
    See more | Go to post

    Leave a comment:


  • But please don't forget to delete everything that was created with new.
    Vectors do manage their objects, but they do not handle the objects pointed to by the pointers they manage.

    I.e. you have to delete every associated object yourself.
    In the MyGraph::~MyGra ph implementation you should add:
    Code:
    for (std::vector<Node*>::iterator i = List.begin(); i != List.end(); ++i)
    	{
    		if (*i)
    			delete
    ...
    See more | Go to post

    Leave a comment:


  • Code:
    MyGraph::MyGraph(int size)
    {
        Maxnodes=size;
        for (int i=1;i<=Maxnodes;i++)
        {
            Node* temp=new Node(i);
            List.push_back(temp);
        }
        m=0;
        count=0;
    }
    I think you should add temp->id = i; above List.push_back( ...).
    But this is only one problem of some more issues. I'll check back later, if no one else found it then.

    Edit:
    ...
    See more | Go to post

    Leave a comment:


  • There's a small typo in line 2 of your code, Savage. It should be:
    Code:
    while(cin.get(c))
    See more | Go to post

    Leave a comment:


  • In line 109:
    Code:
    Akmes[count]=akmi;
    You are accessing Akmes with the index count, without checking wether Akmes has enough memory reserved for count elements.
    Also, where do you new[] and delete[] your array called Akmes?

    I'd recommend you use std::vector<Nod e*> or std::vector<std ::shared_ptr<No de>> with the latter being C++0x and therefore only available in VC++2010 and g++4.6 or so (maybe others too, don't...
    See more | Go to post

    Leave a comment:


  • An abstract class with a (or more) pure virtual methods cannot be instantiated:
    Code:
    class Abstract {
    public:
       virtual void pure_virtual() = 0;
    };
    Any child class needs to override this method. Therefore with pure virtual methods you must override them (if you want to instantiate the class), and virtual methods may or should be overridden.
    See more | Go to post

    Leave a comment:


  • You need to declare the Heap::remove and Heap::showRoot methods inside the class' declaration:

    Code:
    class Heap {
    public:
    int treeData[1000]; // a heap of up to 999 elements. position 0 is kept for size
    Heap();
    void add(int);
    void remove();
    void showRoot();
    };
    Also I think the constructor name should be case sensitive, so you should change the name of the constructor to Heap. Also,...
    See more | Go to post

    Leave a comment:


  • Code:
    sum = (num1 * (Math::Pow(1 + (num2*.01),num3)));
    fix'd. (there was one closing bracket misplaced)
    See more | Go to post

    Leave a comment:


  • tdlr
    started a topic Best way to export blender animation for the web?

    Best way to export blender animation for the web?

    Hello,

    I've just created a blender animation with 5000 frames. Now I need to export it so that it fits the following requirements:
    - It needs to be fluent at a transfer rate of only 1000kbit/s
    - Flash would be highly appreciated

    These requirements are not my own but they are just there.
    So now because blender has no way of exporting to flash, there's no easy way for me out.
    Also, which resolution...
    See more | Go to post

  • tdlr
    replied to how can i extract a file in c ?
    in C
    Of course, this would be the one and only way to go. You may have a look at how it's done with the "tar" format, which is basically just a container format: http://en.wikipedia.org/wiki/Tar_%28...Format_details
    See more | Go to post

    Leave a comment:


  • tdlr
    replied to how can i extract a file in c ?
    in C
    It would help to know, how exactly you are "copying the files into the archive". If you do a simple binary append, you could just reserve the first X bytes of the file for an integer Y representing the header length, followed by a file header which is exactly Y bytes long. Store the file names and their starting byte positions in the header. Then, if you want to "unpack" a file, look up its position in the header, and copy the...
    See more | Go to post

    Leave a comment:


  • tdlr
    started a topic Solution for handling boost::thread with member functions
    in C

    Solution for handling boost::thread with member functions

    I'm using VC++ 2010 with Boost 1.43.
    I've just created a class that uses winsock to handle network communication. Now there's a method called "fillQueue" which is defined like this:
    Code:
    void fillQueue(NetworkQueueTS& nq);
    Problem is, the method enters an infinite while loop which fills the NetworkQueue with data. So it needs to be in an extra thread. The NetworkQueue class itself is already thread...
    See more | Go to post

  • tdlr
    replied to The value of i is huge in this for loop !?
    in C
    @Dheeraj Joshi:
    Of course, you're right. And of course I meant:
    Code:
    v = (int*) malloc(n*sizeof(int));
    /*...*/
    free(v)
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...