Senin, 31 Oktober 2016

What is the difference between C and C++ programming languages

Let’s consider the following C++ program which prints “Hello World” on to the console or terminal window. We will look at various elements used in the program. 1 2 3 4 5 6 7 8 //C++ program to print “Hello World” #include <iostream> using namespace std; int main() { cout<<“Hello World”; return 0; } Output of the above code is: 1 Hello World   In the above program, iostream is the name of a header file which contains I/O functionality. In order to take input and print some output using our C++ program, we have to include that header file

The post What is the difference between C and C++ programming languages appeared first on Coding Security.


What is the difference between C and C++ programming languages
read more

What is formatted and unformatted data in C++

Data which is received by the program without any modifications and sent to the output device without any modifications is known as unformatted data. On the other hand, sometimes we may want to apply some modifications to the actual data that is being received or sent. For example, we might want to display an integer in hexadecimal format in the output, leave some whitespace when printing a number and adjustments in the decimal point. Such modified data in known as formatted data.   As an example for formatted data, if we want to display a decimal number in hexadecimal format,

The post What is formatted and unformatted data in C++ appeared first on Coding Security.


What is formatted and unformatted data in C++
read more

How to access object members in C++

After creating an object, we can access the data and functions using the dot operator as shown below: object-name.variable-name; (or) object-name.function-name(params-list);   Based on our student class example, we can access the get_details() function as shown below: std1.get_details(); std2.get_details();   The complete program which demonstrates creating class, creating objects, and accessing object members is as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

The post How to access object members in C++ appeared first on Coding Security.


How to access object members in C++
read more

Minggu, 30 Oktober 2016

Different types of constructors in Programming

A constructor can be classified into following types: Dummy constructor Default constructor Parameterized constructor Copy constructor Dynamic constructor   Dummy Constructor   When no constructors are declared explicitly in a C++ program, a dummy constructor is invoked which does nothing. So, data members of a class are not initialized and contains garbage values. Following program demonstrates a dummy constructor: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include <iostream> using namespace std; class Student { private: string name; string regdno; int age;

The post Different types of constructors in Programming appeared first on Coding Security.


Different types of constructors in Programming
read more

How does sessions work in servlets

A session is a collection of HTTP requests, over a period of time, between a client and server. Maintaining the data within the session is known as session tracking. For example, maintaining the book details added to the cart in an online book shop application. Session tracking mechanisms include the following: URL rewriting (query strings) Hidden form fields Cookies HTTP session (Session objects)   URL Rewriting   In this method we keep track of the data by passing the data as a query string from one page to another page. A query string starts with ? symbol and is followed

The post How does sessions work in servlets appeared first on Coding Security.


How does sessions work in servlets
read more

How to perform event handling in javascript

The programming which allows computations based on the activities in a browser or by the activities performed by the user on the elements in a document is known as event-driven programming. An event is the specification (essentially an object created by the browser and JavaScript) of something significant has occurred. Examples of events are click, submit, keyup etc. In JavaScript all the event names are specified in lowercase. An event handler (essentially a function) is a set of statements (code) that handles the event. Below table lists most commonly used events and their associated tag attributes: Event Tag Attribute blur

The post How to perform event handling in javascript appeared first on Coding Security.


How to perform event handling in javascript
read more

Sabtu, 29 Oktober 2016

How to create and execute servlet manually

A servlet is a normal java class which follows these set of rules: Should be a public non-abstract class. Should be a subtype of servlet.Servlet interface or  HttpServlet  class. Should contain a zero or no argument constructor. The inherited methods from the Servlet interface should not be declared as final.   Following are the basic steps for creating and executing a servlet: Create a HTML page (optional) Create the Servlet file Create the web.xml (deployment descriptor) file Deploy the application   Creating a HTML Page   First thing we will do is create a HTML page called index.html with the

The post How to create and execute servlet manually appeared first on Coding Security.


How to create and execute servlet manually
read more