Search:

Type: Posts; User: Mostly Harmless

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Take a look at rsync. There are a few front-ends...

    Take a look at rsync. There are a few front-ends (grsync, for one). I use it to back up all of my machines to an external HDD, and to my fileserver over the network.
  2. Replies
    15
    Views
    2,903

    FYI, NTFS doesn't use a FAT, it uses a MFT.

    FYI, NTFS doesn't use a FAT, it uses a MFT.
  3. Have you tried running this code? There are some...

    Have you tried running this code? There are some issues you need to fix:

    main() always returns an int.
    You need a name qualifier for your iostream objects (std::cin, etc.).
    You initialize...
  4. Replies
    5
    Views
    2,207

    You could also use a vector with...

    You could also use a vector with std::random_shuffle(), but that takes the fun out of things.
  5. Replies
    11
    Views
    3,966

    I think you're overcomplicating it by trying to...

    I think you're overcomplicating it by trying to implement two things at the same time without having a firm grasp on either. Write a Car class that can only handle one car at a time. Then implement a...
  6. Replies
    32
    Views
    4,173

    If you're going to copy and paste my code, at...

    If you're going to copy and paste my code, at least read the comments I put in, then maybe remove them. O.o
  7. Replies
    11
    Views
    3,966

    A few small things quickly, because it's after...

    A few small things quickly, because it's after 2am here, and I don't want to say anything stupid. ;)


    The class attributes should be private, not protected (as stated in the specs).
    You...
  8. Replies
    32
    Views
    4,173

    You beat me to my reply. ;-) To...

    You beat me to my reply. ;-)



    To instantiate and object means to create an instance of that object. That is, you can't use Carpet directly. Think of Carpet as any other data type, like an int...
  9. Replies
    32
    Views
    4,173

    It's a start. A few general things before I get...

    It's a start. A few general things before I get to the problem at hand:

    #include <iostream>, not <stdio.h>. stdio.h is the C standard I/O library.
    You forgot a closing bracket at the end of the...
  10. Replies
    32
    Views
    4,173

    The links g4j31a5 are what you need. That's how...

    The links g4j31a5 are what you need. That's how and where you start.

    Break down the assignment into steps:

    1) Create a structure named Carpet
    2) that has two public data members: lengthInFeet...
  11. Replies
    1
    Views
    743

    Bigraph help.

    I'm trying to figure out an efficient way of implementing a graph, and I'm not sure how to go about it. More specifically, say I have five members (vertices) whose edges are as follows:


    A - B
    B...
  12. Replies
    3
    Views
    1,287

    Efficient search with std::map?

    I have a struct, point, which stores (x, y) coordinates. I've created a map, point_map, to hold 256 points. What I need to do is ensure that no two points are the same. The code I've written works,...
  13. Oops. Should have copied and pasted rather than...

    Oops. Should have copied and pasted rather than typed it. Here's the broken code as it stands (I made the array smaller for brevity):


    #include <iostream>
    #include <string>
    #include <fstream>...
  14. Error with sorting an array of structs

    The following code works when I keep the class outside of main(), but if I define the class in main(), I get the error: error: no matching function for call to ‘sort(main()::student [10],...
  15. Replies
    10
    Views
    1,283

    The flow of a C++ program isn't to start at the...

    The flow of a C++ program isn't to start at the top and work your way down. The program starts (and usually ends) in the main() function. That means that if you want something done after you print...
  16. Replies
    6
    Views
    1,251

    I'm assuming, then, that I couldn't convince...

    I'm assuming, then, that I couldn't convince std::sort() to do the job on a vector of B*?
  17. Replies
    6
    Views
    1,251

    That works great, but I need the queue to hold...

    That works great, but I need the queue to hold type B*, not B, so:
    std::priority_queue<A<std::string>::B*>
    The problem is, I still need it to sort using operator< (or B::weight). How would I go...
  18. Replies
    6
    Views
    1,251

    priority_queue

    I'm looking to create a priority_queue with the vector created in main() using B::weight to order the queue. How might I go about doing that?


    #include <vector>
    #include <string>

    template...
  19. After reading this, then looking at my code, I...

    After reading this, then looking at my code, I realized how wrong my original design was. It's great how a tiny change in perspective can make everything fall into place. Thanks for the insight.
  20. Question about accessing private data when I shouldn't.

    In the following code, I want main() to have access to some data that it doesn't (and shouldn't) have access to:


    #include <vector>
    using namespace std;

    template <typename T>
    class A
    {...
  21. Replies
    2
    Views
    953

    Ah, works like a charm. Thank you. Any ideas...

    Ah, works like a charm. Thank you.

    Any ideas about the last part?
  22. Replies
    2
    Views
    953

    Class and template questions

    I've got a bit of code that looks something like this:

    template <typename T>
    class A
    {
    private:
    class B
    {
    public:
    B() { count = 0 }
  23. Replies
    6
    Views
    2,083

    I agree with using the variable names in the...

    I agree with using the variable names in the function prototypes. It certainly makes the code easier to understand.


    I almost asked about dynamically creating vectors in my original question,...
  24. Replies
    6
    Views
    2,083

    Swapping pointers

    I have a bit of code that I'm having some trouble with. It looks something like this (I broke it down to make it short and sweet):


    #include <vector>
    #include <string>

    class MyClass
    {...
  25. lists (arrays, vectors, etc.) of different types

    How would you implement a list composed of different types in C++, similar to Python's lists?

    For example:

    a = [3.14, "banana", 12, ["another list", 42]]
Results 1 to 25 of 43
Page 1 of 2 1 2