OODDP Project (Simple Chat Simulation)
OODDP Project (Simple Chat Simulation)
● The scope does not cover live chat over a network, GUI
development, or database integration — those are
considered as future extensions beyond the current
project’s scope.
● The project can be extended in the future by adding
features like timestamps, message deletion, GUI, user
authentication, or even converting it into a network-based
messaging app.
EXISTING SYSTEM
In the current digital world, numerous sophisticated chat
systems and messaging applications exist, such as WhatsApp,
Facebook Messenger, Telegram, and customer service
chatbots. These systems offer a wide range of features
including real-time messaging, multimedia sharing, encryption,
group chats, AI-based responses, and cloud storage. Most of
these applications are developed using advanced technologies,
supported by databases, graphical user interfaces (GUIs), and
internet-based networking. However, these systems are often
complex and difficult for beginners to understand or replicate.
They involve extensive backend infrastructure and third-party
integrations, which go beyond the scope of introductory
programming projects. Therefore, a need exists for a simplified
version that mimics the fundamental operation of a chat system
in an offline, text-based format, purely for learning and
demonstration purposes.
PROPOSED SYSTEM
The proposed system is a simplified, console-based chat
simulation application developed using the C++ programming
language. It is specifically designed for educational purposes to
help beginners understand how basic chat systems work
without the complexity of advanced technologies like
networking, databases, or graphical interfaces. The application
offers two primary modes of communication: one that allows
two users to simulate a conversation by taking turns entering
messages, and another that enables a user to interact with a
basic chatbot. The bot uses predefined responses or simple
keyword-based logic to generate replies, mimicking a
human-like interaction in a very basic form. All conversations
are displayed in a clear, turn-by-turn format that includes
sender labels to differentiate between users or the bot.
Additionally, the system may include functionality to save the
chat history to a text file, allowing users to review previous
conversations and giving them exposure to basic file handling
operations in C++. This project is intended to strengthen
foundational programming skills such as object-oriented
programming, string manipulation, control flow, input/output
operations, and modular code structure. Though simple in
nature, the system provides a solid foundation upon which
more advanced features—such as real-time messaging, user
authentication, database integration, or graphical user
interfaces—can be built in future versions.
MODULE DESCRIPTION
1. User Input and Output Module:
Responsible for taking input from the user and displaying chat
messages on the console.
Create a main .cpp file where the entire program will reside.
For User-to-Bot mode, capture user input and call the Bot class
to generate a response.
The Main Control Module will handle the flow of the program:
8. Exit Conditions:
PROGRAM
#include <iostream>
#include <fstream>
#include <string>
class ChatHistory {
public:
void saveToFile(const string& message) {
ofstream file("chat_history.txt", ios::app);
if (file.is_open()) {
file << message << endl;
file.close();
}
}
};
class Bot {
public:
string getResponse(const string& input) {
if (input == "hello") return "Hi there!";
else if (input == "how are you") return "I'm just a bot, but
I'm doing great!";
else if (input == "bye") return "Goodbye! Have a nice
day!";
else return "I'm not sure how to respond to that.";
}
};
while (true) {
cout << user1 << ": ";
cin.ignore();
getline(cin, msg);
if (msg == "exit") break;
history.saveToFile(user1 + ": " + msg);
cin.ignore();
while (true) {
cout << user << ": ";
getline(cin, msg);
if (msg == "exit") break;
history.saveToFile(user + ": " + msg);
int main() {
ChatHistory history;
Bot bot;
int choice;
if (choice == 1)
userToUserChat(history);
else if (choice == 2)
userToBotChat(history, bot);
else
cout << "Invalid choice!" << endl;
CLASS DIAGRAM
SEQUENCE DIAGRAM
COLLABRATION DIAGRAM
ACTIVITY DIAGRAM
STATE CHART DIAGRAM