Search:

Type: Posts; User: stefanyco

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    0
    Views
    1,126

    Graphs, linked list representation

    So I have a program to write where it reads a file that contains a matrix so to say, so containing n lines of text. For example, the file would contain:

    7 [ number of columns]
    5 [ number of rows]...
  2. Well what would be causing me to get a bad_alloc...

    Well what would be causing me to get a bad_alloc error? And/or CPU time limit exceeded?

    I add print statements after everything and the error seems to be only with adding ints to the vector with...
  3. The data file contains a series of random numbers...

    The data file contains a series of random numbers using a different program that writes to a data.txt file.
    I use srand(time(0)); cout << rand();

    So the file looks like this:

    1485738376...
  4. I'll reply to myself. I ALSO tried: do {...

    I'll reply to myself. I ALSO tried:



    do {
    cin >> number;
    list.push_back(number);
    } while (number);
  5. Problem inputting numbers into vector from file

    Hello! so, I'm implementing quicksort and selection sort using vectors.
    I have the following code. To run I use redirection. i.e. ./program.out <datafile


    int main()
    {
    int number;
    ...
  6. Replies
    2
    Views
    917

    General question

    So I'm relatively new to coding, and I might sound like a noob right now. :( I'd like for my laptop to have a code-friendly environment. I currently use Secure Shell client to create and compile...
  7. Replies
    16
    Views
    2,122

    If only. Professor requires it compile on this...

    If only. Professor requires it compile on this one for a grade. D:

    I'll show him my problematic code, see what he says. hahaha
  8. Replies
    16
    Views
    2,122

    Yea, I've posted in 3 different forums and...

    Yea, I've posted in 3 different forums and haven't been able to get it to compile. I know my implementation logic stuff is correct, because when I rewrote it without the mess it compiled fine.
    g++...
  9. Replies
    16
    Views
    2,122

    @whiteflags Yes. I remember posting this code in...

    @whiteflags Yes. I remember posting this code in frustration, I've fixed the type long ago when I had a brief moment of clarity. Haha

    So, It still doesnt compile for me. Maybe my compiler doesn't...
  10. Replies
    16
    Views
    2,122

    So my solution to rid my code of friend-related...

    So my solution to rid my code of friend-related errors was to implement the function in the class itself. My updated class is as follows:



    template<class object>
    class Tree
    {
    private:
    ...
  11. Replies
    16
    Views
    2,122

    I will try in the morning. Thanks!

    I will try in the morning. Thanks!
  12. Replies
    16
    Views
    2,122

    Yes that is what I currently have. ...

    Yes that is what I currently have.


    template<class object>
    void buildTree(TreeNode<object> *&tree);

    template<class object>
    class Tree
    {
    private:
  13. Replies
    16
    Views
    2,122

    I added the declaration before the class Tree. ...

    I added the declaration before the class Tree.
    The function is implemented as well.

    I am getting error: friend declaration âvoid buildTree(TreeNode<object>*&)â declares a non-template function...
  14. Replies
    16
    Views
    2,122

    I am having trouble with friend functions

    I have the following classes to implement building an expression tree. I have a function that I am having trouble placing: the buildTree function in class Tree. I am getting an undefined reference...
  15. Replies
    6
    Views
    1,270

    Oh no no, I understand that. I knew that I was...

    Oh no no, I understand that. I knew that I was just frustrated when I posted this and posted prematurely. :( I'm getting different errors now such as 'Stack is not a template' or 'template argument...
  16. Replies
    6
    Views
    1,270

    Better than no template, in this context. And...

    Better than no template, in this context.
    And yes, got that.
  17. Replies
    6
    Views
    1,270

    Is using a template better? I keep getting errors...

    Is using a template better? I keep getting errors such as "Stack is not a template" or "TreeNode<char>* TreeNode<char>::left is private within this context"
  18. Replies
    6
    Views
    1,270

    Template question

    So i'm trying to convert a postfix expression to an expression tree and print it. I have the following classes. In the main, I have never really understood how to properly declare stuff. Im getting...
  19. Replies
    23
    Views
    7,165

    So let's say we're using a stack that fluctuates,...

    So let's say we're using a stack that fluctuates, as in infix to postfix expression conversions. At any given moment the stack may be empty, and if so it would abort because of the underthrow? What...
  20. Replies
    23
    Views
    7,165

    throw underflow?

    My professor uses
    throw underflow;
    in code, but I do not know what that does or under what library it is in.



    void Stack<object>::pop()
    {
    if (isEmpty())
    throw underflow;
  21. Replies
    5
    Views
    2,484

    Ah, I'll use a debugger. I somehow only thought...

    Ah, I'll use a debugger. I somehow only thought debuggers were for assembly code. Haha.
    And i have implemented a normal basic stack this way successfully before, that's why i suspected its the...
  22. Replies
    5
    Views
    2,484

    I agree, but pulling this out of main got it...

    I agree, but pulling this out of main got it working somehow. And i am not confident with std::stack and how to implement using that so for now i just need to figure out why * after ) causes seg...
  23. Replies
    5
    Views
    2,484

    Infix to postfix stack class problem

    I am implementing a stack class to convert infix expressions to postfix expressions.
    Program runs when I enter : (A*(B+C))
    for example and gives me the correct ABC+*
    But when I randomly entered...
  24. Replies
    25
    Views
    2,700

    Of course, the completed code has all that good...

    Of course, the completed code has all that good checking stuff. Thank you!
  25. Replies
    25
    Views
    2,700

    Thank you all :) I didn't need to output the...

    Thank you all :)
    I didn't need to output the string with whitespace, that was just for me to check. I also re-read a chapter on pointers and such and figured it out. Sorry!
    Ushakal is correct, by...
Results 1 to 25 of 28
Page 1 of 2 1 2