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<=",...
Type: Posts; User: Leftos
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<=",...
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...
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.
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...
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,...
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...
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...
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...
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...
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++)
Did you use the Brute Force method? Mind sharing your code?
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...
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...
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...
foxman, your corrections worked perfectly, many thanks.
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...
Yeah, you're right on that last part, I shouldn't just have guessed that it initializes to 12:00am.
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.
scanf("%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);...
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...
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...
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...
Example, please?
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...
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");...