Search:

Type: Posts; User: effa

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    13,747

    i'll try getline().thank you everyone.

    i'll try getline().thank you everyone.
  2. Replies
    7
    Views
    13,747

    thats the function given to me.as far as i know...

    thats the function given to me.as far as i know iostream& is in stringstream as ss is in that form from the given test core.i could be wrong.
  3. Replies
    7
    Views
    13,747

    i tried but it says &inStream doesnt have .str()...

    i tried but it says &inStream doesnt have .str() member
  4. Replies
    7
    Views
    13,747

    how do i convert stringstream to string?

    How do I convert from std::stringstream to std::string in C++?

    Do I need to call a method on the string stream?

    i tried .str() but didnt work.




    //cpp
  5. Replies
    8
    Views
    1,766

    urgh dont quite understand what anon trying ti...

    urgh dont quite understand what anon trying ti say there



    mind to explain to me how this works? really confuse now. =_=

    and what do you mean with the return type must be correct.what i did...
  6. Replies
    8
    Views
    1,766

    Vector &Vector ::operator =(const Vector &num); ...

    Vector &Vector ::operator =(const Vector &num);

    doesnt the argument for the operator = have to be a Vector& not an int.
    i tried to use pointer but it didnt work.

    i also even tried to create a...
  7. Replies
    8
    Views
    1,766

    v is a vector v. im doing it in class....

    v is a vector<int> v.
    im doing it in class.
    i've done most of the part for the function


    Vector &Vector ::operator [](const unsigned int index);


    but my prob is how can i get the value...
  8. Replies
    8
    Views
    1,766

    need help with overload operator[]

    here's the problem.
    i was given a test case v[0]=1.
    in order to implement operator[],i need to get the access the value it is refering to which is 1.but im not sure how?





    //initial test...
  9. Replies
    2
    Views
    1,108

    thanks! i get it now :)

    thanks! i get it now :)
  10. Replies
    2
    Views
    1,108

    how to use 'this' for different obj in class

    can anyone help me to understand how the compiler knows which objects we are refering to in class.
    let say there are two objects with the same function methods:
    obj a;
    obj b;
    and there is a...
  11. Replies
    2
    Views
    911

    so,is this right? im assuming what you are...

    so,is this right?
    im assuming what you are trying to say is this can be any object which in this case is v1 and x is v2 .




    if (this->somefunct != x->somefunct){
    ....}
  12. Replies
    2
    Views
    911

    need help with constructor

    //core unit test
    //given 2 constructors

    vector v1;
    vector v2 (5,3);

    //member functions : int dotProduct(const Vector &x)

    int n = v1.dotProduct(v2)
  13. Replies
    11
    Views
    1,655

    hope anyone here can point out where my mistake...

    hope anyone here can point out where my mistake was.tyvm. :)

    h. file



    class node {

    public:
    std::string data;
  14. Replies
    11
    Views
    1,655

    but i tried to return after the delete.it didnt...

    but i tried to return after the delete.it didnt work because of memory leak.to think of that,it does makes because if i did that means im trying to something that doesnt exist..correct me if im...
  15. Replies
    11
    Views
    1,655

    delete[] doesnt work

    i am tryinh to create stack using linked list.
    function below is to pop the last element and my problem is that the previous ptr is the same as current ptr though i did delete it after returning the...
  16. Thread: Error c2679

    by effa
    Replies
    3
    Views
    1,802

    hey i fix it! LOL.. after all the hours i spent...

    hey i fix it! LOL..
    after all the hours i spent on this stupid error..i figure out how to solve it..

    i just need to change

    #


    //my bad!
  17. Thread: Error c2679

    by effa
    Replies
    3
    Views
    1,802

    Error c2679

    anyone knows how to fix this...



    i couldnt figure out why it does this everytime i tried to do a simple cout on the pointer that carries the data




    cout << ptr-> data
  18. Thread: Pointers

    by effa
    Replies
    5
    Views
    858

    hey iMalc. do you mean i need to initialise the...

    hey iMalc.
    do you mean i need to initialise the new array i created then i can use it later on?..but how?
    most of the examples i've seen didnt initialise the new array.

    another que: do you know...
  19. Thread: Pointers

    by effa
    Replies
    5
    Views
    858

    i understand that..but in order to create stack...

    i understand that..but in order to create stack that is not possible.i cant use STL or vector for this stack assignment..so im trying to understand how pointers works then...

    the way i think is:...
  20. Thread: Pointers

    by effa
    Replies
    5
    Views
    858

    Pointers

    hi all..
    i'm a bit confused how the pointer works..




    std::string n;

    //is this right??
  21. Replies
    3
    Views
    2,082

    stack using linked list problem

    having issue with stack using linked list.

    1) the num didnt give any value tho with the cout in count()

    2) how to return string from pop()? i tried many ways like return ptr->s and stuff but...
  22. Thread: dynamic array

    by effa
    Replies
    9
    Views
    1,049

    if i want to use realloc..how should i define the...

    if i want to use realloc..how should i define the type..is it char? isnt this means it will only look into each character in the string but not as a whole string?
  23. Thread: dynamic array

    by effa
    Replies
    9
    Views
    1,049

    i tried the append method and i dont think it...

    i tried the append method and i dont think it will works the way i want it to.


    void Stack :: push(std::string n){
    //create new space when adding element
    const char* n2= n.c_str();...
  24. Thread: dynamic array

    by effa
    Replies
    9
    Views
    1,049

    for this practice,we are not allowed to use othe...

    for this practice,we are not allowed to use othe standard lib besides the string class...so what i trying to do here to create a new space for a string.

    any hints?

    thanks.
  25. Thread: dynamic array

    by effa
    Replies
    9
    Views
    1,049

    this is what i got so far.. void Stack ::...

    this is what i got so far..



    void Stack :: push(std::string n){
    //create new space when adding element

    if (size+1 < maxItems ){
    maxItems *= 2;
    char*array=new char[maxItems];
Results 1 to 25 of 30
Page 1 of 2 1 2