Ai Chat Bot
Ai Chat Bot
Ai Chat Bot
ON
C++ PROGRAMMING
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE OF ENGINEERING
SUBMITTED TO SUBMITTED BY
What is C++?
C++ is a cross-platform language that can be used to create high-performance
applications.
C++ gives programmers a high level of control over system resources and memory.
The language was updated 4 major times in 2011, 2014, 2017, and 2020 to C++11,
C++14, C++17, C++20.
C++ can be found in today's operating systems, Graphical User Interfaces, and
embedded systems.
C++ is portable and can be used to develop applications that can be adapted to
multiple platforms.
As C++ is close to C, C# and Java, it makes it easy for programmers to switch to C++
or vice versa.
C++ Install IDE
An IDE (Integrated Development Environment) is used to edit AND compile the code.
Popular IDE's include Code::Blocks, Eclipse, and Visual Studio. These are all free, and
they can be used to both edit and debug C++ code.
We will use Code::Blocks in our tutorial, which we believe is a good place to start.
C++ Quickstart
Let's create our first C++ file.
Write the following C++ code and save the file as myfirstprogram.cpp (File > Save File
as):
myfirstprogram.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}
C++ Syntax
Let's break up the following code to understand it better:
Example
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}
Example
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}
2.TECHNOLOGY USED :
C++:
C++ gives programmers a high level of control over system resources and memory.
The language was updated 4 major times in 2011, 2014, 2017, and 2020 to C++11,
C++14, C++17, C++20.
\
3.OBJECTIVES OF PROJECT:
Prerequisites:
Experience with a high level language (C, Java, MATLAB) is a prerequisite.
Learning Objectives:
1. Object-Oriented
C++ is an object-oriented programming language which means that the main focus is on objects and
manipulations around these objects. This makes it much easier to manipulate code, unlike procedural or
structured programming which requires a series of computational steps to be carried out.
2. Speed
When speed is a critical metric, C++ is the most preferred choice. The compilation and execution time of
a C++ program is much faster than most general-purpose programming languages.
3. Compiled
Unlike other programming languages where no compilation is required, every C++ code has to be first
compiled to a low-level language and then executed.
The C++ Standard Template Library (STL) has many functions available to help write code quickly. For
example, there are STLs for various containers like hash tables, maps, sets, etc.
5. Pointer Support
C++ also supports pointers which are often not available in other programming languages.
6. Closer to Hardware
C++ is closer to hardware than most general-purpose programming languages. This makes it very useful
in those areas where hardware and software are closely coupled together, and low-level support is needed
at the software level.
5. DISADVANTAGES OF C++ PROGRAMMING:
1. The main disadvantage of C++ is that it is a very complex programming language to learn. If you
are new to learning to code and are not familiar with any other object-orientated programming
languages then it can take a very long time to understand, which limits what you can do with it to
begin with.
2. Many people also see this difficulty as a disadvantage as C++ is pretty inaccessible unless you’re
an accomplished programmer, meaning that it gets ignored in favour of other, simpler languages.
3. One of the key features that make C++ a distinctive programming language is the use of pointers.
Whilst these are very useful, they can take up a lot of system memory which is not ideal when
you’re working on large projects. Pointers can also be tricky to get your head around, and using
them incorrectly can cause your whole system to crash or behave strangely, which is a major
drawback.
4. Using an object-oriented programming language like C++ comes with several security issues
because of features like pointers, friend functions and global variables.
5. Although having control of managing memory is seen as an advantage by many people, having to
manually allocate memory using pointers can be very time consuming and easy to forget when
you are in the middle of coding. If you’re not used to doing this then this manual memory
management is a big disadvantage of C++, as there is no garbage collector feature to automatically
filter out unnecessary data.
6. Finally, when you’re coding in C++ the language is unable to support built-in code threads. This is
a key drawback as the majority of other languages have this function, and it can make your
process a lot slower and more complicated.
(II) PROJECT DESIGN PHASE
(III) IMPLEMENTATION PHASE
C++ CODE:
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <ctime> // must include this header file to use time function
void datetime(){
time_t now = time(0);
char *dt = ctime(&now);
cout<<"The date and time is "<<endl
<< dt <<endl;
}
int main()
{
system("cls");
cout<<"\t\t\t<============================================= W E L C O M E
==========================================>"<<endl;
cout<<"\t\t\t<============================================= I'M A VIRTUAL
ASSISTANT ==========================================>"<<endl;
cout<<"\t\t\t<============================================= MY NAME IS
GAURAV ==========================================>"<<endl;
cout<<"\t\t\t<============================================= I'M HERE TO HELP
YOU ==========================================>"<<endl<<endl;
do
{
cout<<"======================="<<endl;
cout<<"| ENTER YOUR PASSWORD |"<<endl;
cout<<"======================="<<endl<<endl;
string phrase = "enter your password";
string command = "espeak \"" + phrase + "\"";
const char *charCommand = command.c_str();
system(charCommand);
gets(password);
if(strcmp(password, "chintu")==0){
cout<<"\
n<========================================================================
==========================>\n\n";
wishme();
do{
cout<<"\
n<========================================================================
==========================>\n\n";
cout<<endl<<"How can i help you sir...."<<endl<<endl;
return 0;
}
Screenshots of the project are as follows:
OUTPUT:
Screen 1
Screen 2
(IV) CONCLUSION
1. The state pattern is very powerful indeed. It facilitates breaking your program code into
discrete states. This approach has been used successfully in the telecom industry for
decades to produce what is arguably the most solid software in the world. As you can
see, it’s pretty easy to implement state management in C++. With it, you have the ability
to add code in a very structured fashion—just create a new State subclass interface and
implementation file pair. Then just add this code wherever you need it in the program, as
in Listing 8.
2. The state pattern can be used effectively with a small investment in coding. The source
code for this article consists of five C++ header files and five accompanying C++
implementation files. To build this code and try it for yourself, just create a Visual C++
console project, drop the files in, switch off precompiled headers, and away you go!
(V) REFERENCES
1. www.youtube.com
2. www.geeksforgeeks.com
3. www.w3school.com