Search:

Type: Posts; User: Leftos

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    1,908

    Thanks for your input C_ntua. Here's a third...

    Thanks for your input C_ntua. Here's a third question though.

    Question 3
    I'm trying to do something like this in Bison...


    loop_for: FOR var_name COLONEQUALS expression TO {printf("%s<=",...
  2. Replies
    2
    Views
    1,908

    [Flex/Bison] Some questions

    Question 1
    So, as I mentioned in my previous thread, I'm trying to make a parser for a made-up programming language. I'm now at the part of the exercise where we're required to make sure the...
  3. Replies
    4
    Views
    9,349

    Many thanks. I realized what I had to do reading...

    Many thanks. I realized what I had to do reading your suggestion before looking at the code snippet, but it was exactly that.

    Really, many thanks.
  4. Replies
    4
    Views
    9,349

    Yeah, that sounds logical. newline character...

    Yeah, that sounds logical. newline character detected in flex should call a function in bison which should be able to tell if the newline character was read after the program's name, and if so return...
  5. Replies
    4
    Views
    9,349

    [Flex/Bison] Handling newlines

    I'm not sure if a C programming forum is the right place to ask something regarding Flex and Bison, but people around here have been very helpful in the past so I decided to give it a try.

    So,...
  6. Replies
    17
    Views
    7,983

    Another question regarding sorting algorithms. ...

    Another question regarding sorting algorithms.

    I've noticed that most minHeap implementations are maxHeap with the two inequality signs regarding tree items inversed, which makes sense and seems...
  7. Replies
    17
    Views
    7,983

    Answer found!

    So, brute-forcing did work, many thanks cyberfish!

    I was able to mine the conclusions for HeapSort, and here they are directly translated from my Uni's forum as I posted them.


    Doc mentioned...
  8. Replies
    17
    Views
    7,983

    MergeSort demo...

    MergeSort demo

    As you can see, there are cases in which the algorithm requires more comparisons. Try using the Ascending and Descending orders first, then the one called "Strange". You should see...
  9. Replies
    17
    Views
    7,983

    Oookay... So an array with a size of 6, using...

    Oookay... So an array with a size of 6, using MergeSort, gives the attached results. You can of course ignore every permutation below the actual maximum comparsions count. It doesn't take many...
  10. Replies
    17
    Views
    7,983

    Here's the code I'm using to test MergeSort: ...

    Here's the code I'm using to test MergeSort:


    int main(){

    int* myarray = new int[my_size];
    int* myarray2 = new int[my_size];
    int* temp = new int[my_size];

    for (int i=0;i<my_size;i++)
  11. Replies
    17
    Views
    7,983

    Did you use the Brute Force method? Mind sharing...

    Did you use the Brute Force method? Mind sharing your code?
  12. Replies
    17
    Views
    7,983

    Yeah, guess I'll have to use brute-force as a...

    Yeah, guess I'll have to use brute-force as a last resort. Any other ideas, anyone?

    It's going to be hard to implement a million runs of this the way I've structured the code, as I'm using a...
  13. Replies
    17
    Views
    7,983

    Hah! Brute-force! Would never have imagined it!...

    Hah! Brute-force! Would never have imagined it! There's no timing function however that has enough precision to calculate the time required to sort 8 numbers. I had to go up to millions of items in...
  14. Replies
    17
    Views
    7,983

    Sorting algorithms, worst-case input

    NOTE: Not particularly a C++ programming question, rather than a general programming question. Code was done in C++ though, so I chose this sub-forum.

    As part of a data structures project, we're...
  15. Replies
    8
    Views
    9,358

    foxman, your corrections worked perfectly, many...

    foxman, your corrections worked perfectly, many thanks.
  16. Replies
    8
    Views
    9,358

    Well, the recommended way to sort it was...

    Well, the recommended way to sort it was "bubblesort" because that's the "simplest" way to do it. I wouldn't learn anything new if I bubblesorted it though, would I? :) That's why I'm trying to get...
  17. Replies
    7
    Views
    12,236

    Yeah, you're right on that last part, I shouldn't...

    Yeah, you're right on that last part, I shouldn't just have guessed that it initializes to 12:00am.
  18. Replies
    8
    Views
    9,358

    Exactly, that's my problem. I need to know how to...

    Exactly, that's my problem. I need to know how to propery define, declare and call compare, since the struct is declared locally and not globally, which is what the example I read assumed.
  19. Replies
    7
    Views
    12,236

    scanf("%d/%d/%d", &soldiers.dateout.dd,...

    scanf("&#37;d/%d/%d", &soldiers.dateout.dd, &soldiers.dateout.mm, &soldiers.dateout.yyyy);

    int comparedates(struct sdate dateout)
    {
    time_t curtime;
    struct tm tdateout;

    time(&curtime);...
  20. Replies
    8
    Views
    9,358

    QSort on structure array

    I have a structure array that is created in a function locally, in order to copy to it the contents of a linked list so that they can be sorted and then printed.

    How do I implement qsort in this...
  21. Replies
    7
    Views
    12,236

    Getting the difference between dates

    Hello again. What I need to do this time is get a date from the user and then compare it to the current date, to see if there are more than (int days) inbetween those two dates. I looked up a few...
  22. Replies
    46
    Views
    7,081

    I'm getting annoyed with the newline problem. If...

    I'm getting annoyed with the newline problem. If anyone could provide a solution, please do so. Here's the code.


    int main(int argc, char *argv[])
    {
    int choice;
    char choice2[3];

    /* if...
  23. Replies
    46
    Views
    7,081

    Example, please?

    Example, please?
  24. Replies
    46
    Views
    7,081

    What kind of mistakes? I found your explanations...

    What kind of mistakes? I found your explanations pretty well-based.

    Still, can anyone recommend me what course of action should I take in the above part of code so that the fgets command doesn't...
  25. Replies
    46
    Views
    7,081

    I'm already doing that, by insterting \0 in...

    I'm already doing that, by insterting \0 in strlen-1. Let me check which function keeps the \n and I'll get back and edit.

    EDIT: Found it. fgets following scanf is overriden.


    printf("\n");...
Results 1 to 25 of 54
Page 1 of 3 1 2 3