代写C++代码 代做C++程序 C++辅导 C++教学

C++网络家教 远程写代码 在线Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

ECE 263/264

Semester Project

 

The semester project will be based on the social media like messaging. Here, we use derived  data type struct post  as defined below.

 

struct post {

   int timeSent;

   int timeIn;

   int postID;

   char sender[25];

    char receiver[25];

   char M[126];

   char voiceCall;

   char priority;

   char resend;

   char *Sticker;

   struct post    *nextpost;

};

 

You will need to download files they are pr.h, pr2.h, proj_main.c, prj2.c and a library prj.lib. The library file you use will depend on which version of Visual Studio. Net you are using 2010.  You will be shown how to link in a library. The “main” is located in proj_main.c, it does not need to be modified. All the code you are writing will need to be placed in prj2.c. In the library, I have written a number of functions. The protypes for my functions are in proj1.h

Each post that is entered into the link list will have a timeSent( the time the post was sent),  timeIn the( amount of time the postmessage is wafting to be delivered)  priority, sender, resend, and M (the post that is being sent) and sticker .

The problem is such that posts are sent from senders to receivers (destination). There are 10 senders they are "Albert", "Beverly", "Cheyenne", "Donovan", "Eve", "Francis", "George", "Hannah", "Isaac", "Jennifer"

There are five receivers {"Kraig","Lana", "Meagan", "Nancy", "Oscar"}

Postmessages  are created by senders and delivered to receivers. The posts that are created are randomly generated this will be done by the instructors code. You are to deliver posts to the receivers facebook timeln from the delivery queue which is a link list. . New posts generated will be placed at the end of the queue The problem is that a receiver can only be given one post message  at a time from the queue. Thus the queue will start to fill. Every time you receive  a new set of post messages (post messages  will be delivered to you via a link list), you will update your queue, you then deliver the posts messages you are allowed to deliver (at most one post message to a receiver)and increment the timeIn of those post messages  that  remain  in the queue. Any post whose timeIn exceeds 3 needs to be dropped, unless the resend is set to one or the priority is >=1. By delivering a post message you will need to delete the corresponding node, by dropping you will need  to delete the node.

 

The following functions are available and written by the instructor for you to use. They are:

void assignData(struct post*,int);

 

struct post* sortByTimeIn(struct post*);

 

struct post* genNewPostMssg(int);

 

You are to write the following functions

struct post *processMyQ (struct post * head);

void  displayMyQ (struct post *head);

struct post *  deletePost (struct post *post, struct

        post * postToGo);

struct post * deleteAllPostOfSender  (struct  post

           *head,  char *senderName);

struct post *    sortByPriority (struct post *head);

void  terminateWrite (struct post *head);

void  freeList(struct post *head);

 

Functional descriptions of the files you need to write

struct post *process_myQ (struct post * head);

Here you process the link list myQ. You increment the timeIn of all nodes that were in the link list, you call genNewPostMssg() and attach all these nodes onto the end of the link list myQ, you deliver at most one post message to each receiver from the list of posts in the link list(delete at most five nodes in the link list, you search from front of the list), you delete all nodes in the link list which have a timeIn >3 unless they resend equal to 1, if a node has ( timeIn =3 and voicecall=1)  you need to set the resend =1, Lastly you then should call the sortByTime function and then return the head

 

void  displayMyQ (struct post *head);

Here you are to print to the screen each member of the link list is an organized and formatted manner according to the          Receiver,  Sender,, timeSent, timeIn , resend, sticker, message

 

struct post *  deletePost (struct post *head, struct

        post * postToGo);

Here you are to delete the node PostToGo from the link list in a manner that reattaches the necessary links to preserve the link list then you free the memory for postToGo. You will call this in the processMyQ function. Return the head of the link list

 

struct post * deleteAllPostOfSender (struct  post *head,  char *receiverName);

This function is passed the head of the MyQ and a sender name,  the function will delete all messages in the link list that have a sender equal to sender name. This function should return the head of the link list.   

 

void  terminateWrite (struct post *head);

If the user enter this command you are to write all the post messages s that remain in the list to a file called remaingQueue.txt. Each field of the structure should be written to an individual line. After writing you should call freeList and then the program will terminate

 

void  freeList(struct post *head);

Here you should free the list .

 

struct post *    sortByPriority (struct post *head);

Here you should sort the list in decreasing order based on priority

Individually how much each function will be worth

 

processMyQ          33pxs

displayMyQ          23pxs

sortByPriority           23pxs

deletePost          20pxs

deleteAllPostOfSender     13 pts

terminateWrite           15 pts

freeList            15 pts

 

 


相关推荐