讲解:C++ CS 240 Fall 2017 Data StructuresC/C++、C/C++

Introduction按照题目要求完成功能编译命令:make运行:./FaceBookLite输入命令按照题目要求输入组添加了好友功能,好友添加后为相互添加,同时不可重复添加以及添加自己添加了一级二级菜单的提示输出CA 3: “Facebook Lite”CS-240 Fall 2017: Data StructuresGoalIn CA 3, you will continue with C++ I/O and text processing, and you will begin to utilize somewhat morecomplex data structures to store information. In particular, you will implement a linked list container to store,manipulate, and save Facebook-like posts and related information. CA 3 will provide you experience with:• a simple singly linked list container that requires pointers• C++ heap memory management (strategic and extensive use of new and delete)• deep copies of stored data, including in copy constructors and assignment operators• operator implementation and overloading (including assignment operators, unary operators, binaryoperators, and friend functions)• some simple C++ class and object design.This program will be difficult for some of you so please begin early and work on it consistently. You can do itand we will help! When you finish successfully, you will really understand linked lists, operator overloading,deep vs. shallow copy, and more, guaranteed!OverviewWrite a C++ program that reads and stores information from and to text files that contain Facebook Lite Users,which are held in your program as instances of a new FBLUser class that you write. Each FBLUser objectshould contain a unique Userid, a Password, a First name, and a Last name. To store multiple users, you shouldimplement an FBLUser Linked List class (which we will call FBLUserLL), of which your program willcreate exactly one instance (similar to how your CA 2 program created a single instance of the DonorDatabase).In addition to login and name information, each FBLUser object (and therefore your FBLUser C++ class)should also contain a Linked List of FBLPost objects. That is, each FBLUser object should contain anFBLPost Linked List object, which we will call FBLPostLL, and that holds a linked list of instances of anFBLPost C++ class.In Facebook Lite, each FBLPost can be Liked or Commented on (like Facebook). Your program need not trackwhich user likes a post, it should just count the number of likes, by also maintaining an integer counter in eachFBLPost object. You will not have to make sure that a post is not liked more than once by a user.FBLComments should be stored in an FBLComment Linked List object called FBLCommentLL, which is adata member of the FBLPost class.Finally, Facebook Lite Users can Friend one another. Each FBLUser’s friends are stored in a Linked List ofpointers to FBLUsers. That is, the type of the data field of an FBLFriendLL Node is a pointer to anFBLUser.Tackling the Project in PhasesYou will complete this assignment in three phases, to introduce you to large-scale program developmentstrategies. That is, rather than tackling an entire task (assignment) all at once, it can be useful to developfunctionality incrementally. Phase 1 will be submitted as CA 3.1, Phase 2 as CA 3.2, and Phase 3 as CA 3.3,with the functionality of each described below. Each phase will be graded separately.Phase 1 (Turned in as CA 3.1)For this phase, you will implement the FBLUser, FBLUserLL, FBLPost, and FBLPostLL C++ classes,along with two menus.Top Level MenuA Top Level Menu should accept the following commands from your program’s user.CREATE This operation creates a new Facebook Lite User, assigning into the data fields the information on the rest of theline. You may assume (i) that the fields are separated by whitespace, (ii) that none of them contain whitespace,and (iii) that there are exactly 5 C++ “strings” on the line. You should check to make sure the hasnot yet been used, but the other fields have no limitations, even in terms of special characters, etc. (Errorchecking this input is not part of Phase 1.)LOGIN This operation logs a user in, so that (for example), the correcC++代写 CS 240 Fall 2017 Data Structures代写C/C++实验、C/C++编程代写t feed will be displayed when requested. TheLOGIN operation should bring your program’s user to the 2 nd Level Menu, described below.QUITThis command ends the program.2 nd Level MenuThe 2 nd Level Menu should support the following commands:LOGOUTThe LOGOUT operation brings the user back to the Top Level Menu.POST This operation creates a new Facebook Lite posting, “from” the currently logged in FBL User. The POSTcommand is separated by whitespace from the text of the post itself; after “POST” and all of the whitespace thatfollows it, the entire rest of the line should be considered the user’s post (including subsequent whitespace). Thepost will not, however, span multiple input lines. So in response to a POST command, your program shouldcreate a new FBLPost object and insert it into the currently logged in FBL user’s FBLPost Linked List.READThis operation should display the first FBLPost in the currently logged in user’s own list of postings (fornow), and remove it from that list. 1Posts should be displayed in the order they are inserted… the oldest post should be displayed first. If yourprogram’s user tries to READ from an empty feed, your program should display the message “Nothing to1 We will change this functionality for future phases. Later, an FBLUser’s feed will contain posts from other FBLUsers; for CA 3.0,it contains the user’s own posts only.READ”.SummaryThat’s it for Phase 1 (CA 3.1): A Top Level menu consisting of three operations: CREATE, LOGIN, and QUIT,along with a 2 nd Level menu that supports LOGOUT, POST, and READ. Minimal error checking; you mayassume that input lines are all well-formed.To implement this functionality, you will need the following four C++ Classes:FBLUser, FBLUserLL, FBLPost, and FBLPostLLYou will also need two different Linked List Node C++ Classes, one for the FBLUserLL class and one for theFBLPostLL class.For CA 3.1, you should not support Likes, Comments, or Friends. Focus instead on reading in the commandsfrom the user, and getting the simple Linked List operations working correctly. CREATE and POST areessentially Linked List insert() operations, on FBLUserLL and FBLPostLL linked list objects,respectively. LOGIN and CREATE require traversals of FBLUserLL, and READ requires you to remove asingle node from one end of an FBLPostLL object.Phase 2 (CA 3.2)So far (in Phase 1), when a user creates a post, that post gets copied only into his or her own linked list of posts.The next phase of the assignment will allow users to read other users’ posts, made by their friends only. Eachuser should have a wall of his or her own posts (only, in Facebook Lite), and a feed of posts made by all friends.Add an STL vector of friends to the FBLUser class, so that each user has a vector of friends. Pick anappropriate type for the vector template parameter, based on what you will need to do with those friends!(below)Now, add to the 2 nd level list a FRIEND option, as follows:FRIEND That should make the user identified by be a friend of the currently logged in user, by addingNow, when a user posts something, your program should insert that post into the poster’s own wall (i.e. his orher linked list of posts), as for Phase 1, but also into each friend’s feed. For now, make a copy of the post andinsert that copy into each friend’s feed. You may make the feed a vector of posts, or a linked list of posts, it’s upto you.Now, make a new function in the 2 nd level menu to display all of the logged-in user’s friends’ full names. Sotyping:MYFRIENDS…might show:Joe SchmoTom BradyBarack ObamaAdd two functions called MYFEED and MYWALL that show the logged-in user’s feed linked list of posts (byother users), and his or her wall linked list of posts that he or she has made. These options should display all theposts, but not remove any.转自:http://ass.3daixie.com/2019030313744781.html

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Introduction按照题目要求完成功能编译命令:make运行:./FaceBookLite输入命令按照题目要...
    fenjiandian阅读 1,225评论 0 0
  • By clicking to agree to this Schedule 2, which is hereby ...
    qaz0622阅读 5,429评论 0 2
  • 夜观澜霓虹殇,楼宇萧萧,耳闻汽笛。寒流已至,怎奈秋裤悲凉。雾霾里,伊人渐远。初雪下,叶叶飘零,满目伤。故人何在,人...
    尘世子阅读 1,810评论 1 3
  • 时常觉得自己不够精明 也羡慕过在各种关系中游刃有余穿梭自如的聪明人 渐渐的 学不会精明的我通过沉默和隐藏来保护自己...
    kristy77阅读 1,306评论 1 0
  • tab效果 整体思路是先在CSS中设置好相应的active类,然后根据事件,给元素增加或者删除样式类,不通过JS直...
    DeeJay_Y阅读 1,639评论 0 0

友情链接更多精彩内容