Search:

Type: Posts; User: Zosden

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    41
    Views
    5,398

    #ifndef COMPARATOR_H #define COMPARATOR_H...

    #ifndef COMPARATOR_H
    #define COMPARATOR_H
    #include "View.h"

    class Comparator{

    bool operator <(const View::Election::Candidate *& lhs, const View::Election::Candidate *& rhs){
    return...
  2. Replies
    41
    Views
    5,398

    what would I pass a new Comparator

    what would I pass a new Comparator
  3. Replies
    41
    Views
    5,398

    That still doesn't fix my original problem.

    That still doesn't fix my original problem.
  4. Replies
    41
    Views
    5,398

    Yes I know everything works. I'm not a brand new...

    Yes I know everything works. I'm not a brand new to programming, and I've tested my code thoroughly. I just wanted to know how to sort a vector of pointers. The assignment is to have a vector of...
  5. Replies
    41
    Views
    5,398

    #ifndef COMPARATOR_H #define COMPARATOR_H...

    #ifndef COMPARATOR_H
    #define COMPARATOR_H
    #include "View.h"
    class Comparator{
    bool operator () (const View::Election::Candidate*& lhs , const View::Election::Candidate*& rhs){

    return...
  6. Replies
    41
    Views
    5,398

    Those are the only pointers that I have to have...

    Those are the only pointers that I have to have for the assignment. Would having the class that just has the operator< work with the pointers.
  7. Replies
    41
    Views
    5,398

    which pointer messes it up. I can change it.

    which pointer messes it up. I can change it.
  8. Replies
    41
    Views
    5,398

    The compiler gives me this final error bool...

    The compiler gives me this final error


    bool operator<(const View::Election::Candidate*& lhs , const View::Election::Candidate*& rhs){
    return *lhs->myTotalNumberOfVotes <...
  9. Replies
    41
    Views
    5,398

    Where would I overload the operator< at. Outside...

    Where would I overload the operator< at. Outside or inside the class, and If so how does it know to use that operator overload.
  10. Replies
    41
    Views
    5,398

    What would I place in the third parameter exactly...

    What would I place in the third parameter exactly or what pointer could I get rid of to make it easier.
  11. Replies
    41
    Views
    5,398

    Would something like this work. ...

    Would something like this work.


    std::sort(myElections->at(i)->myCandidates->begin(), myElections->at(i)->myCandidates->end(), Election::Candidate::operator ());
  12. Replies
    41
    Views
    5,398

    Where would I put that in. It won't compile when...

    Where would I put that in. It won't compile when I do this.


    std::sort(*(*myElections->at(i)->myCandidates->begin()), *(*myElections->at(i)->myCandidates->end()));
  13. Replies
    41
    Views
    5,398

    This is for a class, in which I'm suppose to...

    This is for a class, in which I'm suppose to learn c++. I'm trying to do that I understand nobody would use pointers like this. I used them like this in order to get use to using pointers. By the way...
  14. Replies
    41
    Views
    5,398

    I think that did the trick. Thanks man. Sorry for...

    I think that did the trick. Thanks man. Sorry for being short with you I'm just used to people who say something like you did in the beginning and then offer no help cause I'm not doing it their way....
  15. Replies
    41
    Views
    5,398

    ok thanks I forgot to add the pointers to that. I...

    ok thanks I forgot to add the pointers to that. I probably should take a break from the homework. How do I do the sort part. This is what I have.

    ...
  16. Replies
    41
    Views
    5,398

    They aren't wrong and I know how to use them, and...

    They aren't wrong and I know how to use them, and they do point to something. I'm not an idiot. I just wanted to know how to sort the vector in c++. Could you show me an example. you don't have to...
  17. Replies
    41
    Views
    5,398

    This is what I have so far what am I doing wrong....

    This is what I have so far what am I doing wrong.


    std::sort(myElections->at(i)->myCandidates->begin(), myElections->at(i)->myCandidates->end(), Election::Candidate::operator ());

    for this...
  18. Replies
    41
    Views
    5,398

    It's a project for school I just wanted to get...

    It's a project for school I just wanted to get used to pointers. I'm new to c++ learned java last year. I just made everything a pointer so I could work with them. How would I do what you said.
  19. Replies
    41
    Views
    5,398

    Sorting Vector of structs.

    I have a data structure that looks like this.


    struct Election{
    struct Candidate{
    vector<int*>* myPrecincts;
    string* myName;
    int* myTotalNumberOfVotes;
    };...
  20. Replies
    6
    Views
    2,037

    Wait here is the problem how do I do this right ...

    Wait here is the problem how do I do this right



    ifstream ifstr(myInputFile.c_str());
    if(!ifstr)
    {
    cerr << "Cannot open: " << myConversionTableFile << "." << endl;
    exit(ERROR); ...
  21. Replies
    6
    Views
    2,037

    It gives me an terminate called after...

    It gives me an

    terminate called after throwing an instance of 'std::out_of_range'
    what(): vector::_M_range_check
    Aborted

    when I run it and it is a pointer to that vector
  22. Replies
    6
    Views
    2,037

    Vector of Vectors

    How do you traverse through double vectors.



    for(int l = 0; l < myWordsInLetter->size(); l++)
    {
    for(int m = 0; m < myWordsInLetter->at(l).size(); m++)
    {
    cout <<...
  23. Replies
    5
    Views
    1,347

    Ignore ME sorry I figured it out.

    Ignore ME sorry I figured it out.
  24. Replies
    5
    Views
    1,347

    Thanks the temp struct idea worked.

    Thanks the temp struct idea worked.
  25. Replies
    5
    Views
    1,347

    vectors of structs

    Hey I'm pretty new to C++ but have quite a bit of experience in Java. I have a project to make a Morse code translator. I have a struct that holds a letter and its morse code equivalent. Then I have...
Results 1 to 25 of 30
Page 1 of 2 1 2