程序
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXREQS 15000
#define SUMLEN 1500
typedef struct Requests
{
char sender[10]; //sender name, all recivers are the same
int length; //the length of each request
}Reqs;
typedef struct Senders
{
char name[10]; //sender name
int Newlength; //the total length of each sender
}Send;
//check if str[] is in the send[], if yes return its procession, if no return -1
int IsRepeat(char str[], Send send[])
{
int i = 0;
int index = -1;
for(i=0; i<MAXREQS; i++)
{
if (strcmp(str, send[i].name) == 0)
{
index = i;
break;
}
}
return index;
}
int main(int argc, char *argv[])
{
FILE *fp