Professional Documents
Culture Documents
Challenge 2
Challenge 2
1 Abstract
This challenge for ECE 131L aims to introduce students to the development
of a basic social media platform with a focus on data structures, algorithms,
and user interaction. The challenge covers various topics taught in class such as
arrays, strings, structures, file I/O, and basic algorithms, while also emphasizing
the importance of user experience and error handling.
2 Introduction
Social media platforms play a significant role in modern society, facilitating
communication, information sharing, and networking. In this challenge, stu-
dents will develop a simplified social media platform allowing users to create
accounts, post messages, follow other users, and view their feed.
3 Background
A social media platform typically consists of data structures to store user in-
formation, posts, and relationships between users. Basic algorithms are used to
implement functionalities such as posting messages, following users, and gener-
ating a user’s feed. Additionally, error handling and input validation are crucial
for ensuring a smooth user experience.
4 Methodology
The methodology for this challenge involves the following steps:
1. Define structures for User and Post, including attributes such as username,
password, email, post content, timestamps, etc.
1
3. Utilize file I/O to store and retrieve user information, posts, and relation-
ships between users, ensuring data persistence across program executions.
4. Implement error handling and input validation to provide a seamless user
experience and prevent program crashes.
5 Expected Results
The expected result of this challenge is a functional social media platform that
allows users to create accounts, post messages, follow/unfollow other users, and
view their feeds. Users should be able to register with a unique username,
post messages with timestamps, follow/unfollow other users, and see posts from
users they follow in their feeds. Additionally, the system should handle errors
gracefully and provide informative messages to users in case of invalid input or
other issues. See the ”C template” for additional expectations.
6 Code Requirements
Students are required to implement the following functions along with necessary
data structures:
Function Signature
void create_account(User *users, int *num_users);
Example Implementation
void create_account(User *users, int *num_users) {
// Implementation to be provided by the student
}
Functionality
The function should prompt the user to enter their username, password, and
email, and then add the new user to the users array.
Function Signature
void post_message(User *users, int num_users);
2
Example Implementation
void post_message(User *users, int num_users) {
// Implementation to be provided by the student
}
Functionality
The function should prompt the user to enter their username and the message
they want to post, and then add the message to the user’s list of posts.
Function Signature
void follow_user(User *users, int num_users);
Example Implementation
void follow_user(User *users, int num_users) {
// Implementation to be provided by the student
}
Functionality
The function should prompt the user to enter their username and the username
of the user they want to follow, and then update the list of users they follow.
Function Signature
void generate_feed(User *users, int num_users);
Example Implementation
void generate_feed(User *users, int num_users) {
// Implementation to be provided by the student
}
Functionality
The function should prompt the user to enter their username and then display
the messages posted by users they follow, sorted by timestamp.
3
6.5 Additional Tasks
Students should further enhance the social media platform by implementing the
following additional tasks:
Function Signature
void unfollow_user(User *users, int num_users);
Functionality
The function should prompt the user to enter their username and the username
of the user they want to unfollow, and then update the list of users they follow
accordingly.
Function Signature
void delete_account(User *users, int *num_users);
Functionality
The function should prompt the user to enter their username and password for
confirmation, and then remove their account from the system.
Function Signature
bool authenticate_user(User *users, int num_users);
Functionality
The function should prompt the user to enter their username and password and
verify if the credentials match any existing user accounts.
4
Functionality
Add privacy settings to user accounts, allowing users to choose whether their
posts are visible to everyone, only to their followers, or only to themselves.
7 Evaluation Criteria
Students will be graded based on the following criteria:
• Correctness of the implementation: Does the program produce the ex-
pected output?
8 Conclusion
By completing this challenge, students will gain practical experience develop-
ing a basic social media platform focusing on data structures, algorithms, user
interaction, and error handling. They will deepen their understanding of con-
cepts learned in the class such as arrays, strings, structures, file I/O, and basic
algorithms, while tackling a real-world problem.