yeah I was going to make January = 1, but instead I'm using strcmp. I still have it adding the day+31+28+leap... like that though.
Type: Posts; User: Hikaru90
yeah I was going to make January = 1, but instead I'm using strcmp. I still have it adding the day+31+28+leap... like that though.
yeah I don't think that's what I'm supposed to do, and I didn't realize that it mattered that I do the dayofyear now. I created a function for the day of year, so like if month = January, dayofyear...
ok so
struct student *info;
info = malloc(sizeof(struct student)*MAXLENGTH));
for (i=0; i<MAXLENGTH-1; i++)
{
int *value[i];
value[i] = malloc(sizeof(struct...
struct student *info;
info = (struct student*)(malloc(sizeof(struct student)*MAXLENGTH));
for (i=0; i<MAXLENGTH-1; i++)
{
int *value[i];
value[i] = (struct...
struct student *info;
info = (struct student*)(malloc(sizeof(struct student)*MAXLENGTH));
for (i=0; i<MAXLENGTH-1; i++)
{
int *value[i];
value[i] =...
yeah, the file shows the number of classes, then number of students, then the students firstname, lastname, month, day, year on same line, then next line is number of queried students, and then the...
Your saying the &info part of the Mergesort is wrong right? I already have this
struct student *info;
info = (struct student*)(malloc(sizeof(struct student)*MAXLENGTH));
Are you saying I...
Hi, could someone please help me with my main function that has merge sort in it?
I'm not sure how to call it or how this should be set up. I read in a file that has students and they are...
yeah I guess I would have to do something different for December because the problem says it's not sorted by year, only month and day for the birthdays. Maybe I can make another function or if...
we're supposed to use strcmp if the person has the same b-day as someone else.
month would be an array month[length], unless I changed it to an int or I could maybe set January to equal 1, but I don't know where I would go from there, or I could add up the days and determine...
I'm just trying to get the idea of how I would do this, and I said I was talking about after the sorting, which also means after reading in the input. The input was read in the way it is in the file...
There is an input file that says the birthdays of each person.
The date in the input file would be written as JANUARY 31 1989, but the year doesn't matter because it's sorted by birthdays, not by...
After people are sorted in order of their birthdays, how can I subtract two birthdays to find out the days in between so I can know if the person to the left or the right of someone has the closest...
Oh I have another struct now called customer and it has the name and time.
I scanned in what was in the input file, which was # of days and # of customers. Then
# of secs after 1pm they get in line, their name, and # of items bought on the same line in the file. Time...
For the time, it also says the # of secs it takes to checkout of line once at front is
40+60x(# of items being bought).
I haven't done anything for the time since I'm not sure how to do it yet, but I put
char name[MAXNAMELEN+1]; in the main.
yeah we could use queues with a linked list or array, but I already started with a linked list, and I think that was the preferred way.
Oh, and I forgot to include this:
#define...
Hi, I need to have 3 lines and I need help with them please.
This is example of the output:
1:00:11pm: Customer ANGEL checking in line A.
1:01:36pm: Customer ANGEL checking out of line 1 waited...
This creates a new and space for it right?
struct queue *A = (struct queue*)malloc(sizeof(struct queue));
By the way, these are my structs:
// Stores node of the linked list.
struct node {...
ok, but now it says invalid initializer. Are they supposed to be pointers and am I supposed to allocate space?
How do I make several queues? Do I make just one struct and then do this in main:
A = NewQueue();
B = NewQueue();
or is it:
struct queue Q1;
struct queue Q2;
When making a struct, why do some structs have struct* ? Does that mean there is a pointer to the struct? If so, then why would it be struct* block, instead of struct *block? Thanks in advance.
fscanf(ifp, "%d", &num_couples);
for(i=0; i<num_couples; i++)
{
for(j=0; j<num_couples; j++)
{
fscanf(ifp, "%s", man_name[j]);
...