Found 33676 Articles for Programming

C program to generate an electricity bill

Bhanu Priya
Updated on 24-Mar-2021 12:54:05

10K+ Views

Based on the units consumed by the user, the electricity bill is generated. If number of units consumed are more then, the rate of a unit charge will also increase.The logic applied if minimum units are consumed by the user is as follows −if (units < 50){    amt = units * 3.50;    unitcharg = 25; }The logic applied if units are in between 50 to 100 is given below −else if (units

How to add two complex numbers by passing structure to a function in C language?

Bhanu Priya
Updated on 24-Mar-2021 12:36:51

7K+ Views

In order to add two complex numbers in C programming language, the user has to take two complex numbers as structure members and perform addition operation on those two numbers by creating a user-defined function.AlgorithmRefer an algorithm given below for addition of two complex numbers.Step 1: Declare struct complex with data members. Step 2: Declare name for structure and variables. Step 3: Enter real and imaginary part for first complex number at run time. Step 4: Enter real and imaginary part for second complex number at runtime Step 5: Compute addition of number1 and number2 by calling function. Go to ... Read More

Difference Between Linear Search and Binary Search

Ravi Ranjan
Updated on 21-Aug-2025 19:18:50

3K+ Views

A linear search compares the target element with each array element, while a binary search uses divide-and-conquer method to efficiently search for the target element. In this article, we will compare linear search and binary search. What is Linear Search? Linear search is a sequential searching algorithm where we traverse every element within the input array and compare it with the target element to be found. If the target element is found, we return true and the index, and return false if the element is not found in the given array. Below is an animation of working of linear ... Read More

Difference Between Applet and Application

AmitDiwan
Updated on 23-Mar-2021 08:42:12

3K+ Views

In this post, we will understand the difference between Applet and Application.ApplicationThey are similar to Java programs.They can be executed independently without using web browser.It requires a ’main’ function for it to be executed.Java applications have full access to local file system and network.They can access all kinds of resources that are available to the system.They can execute the programs with the help of the local system.An application program is required when a task needs to be directly performed for the user.AppletsThey are small Java programs.They have been designed to be included with HTML documents.They need Java enabled web browser ... Read More

Difference Between B-tree and Binary tree

Kiran Kumar Panigrahi
Updated on 20-Feb-2023 16:14:47

7K+ Views

There are two types of non-linear data structures namely, B-Tree and Binary Tree. These two terms sound similar but they are absolutely different from each other. The most basic difference between a B-Tree and a Binary Tree is that a B-Tree is used for data storage on a disk, whereas a Binary Tree is used for data storage in RAM. Read this article to learn more about B-tree and Binary Tree and how they are different from each other. What is a B-Tree? B-Tree, also called Balanced Sort Tree, is a type of balanced M-way tree. In a B-tree, the ... Read More

Difference Between Link and Association

AmitDiwan
Updated on 23-Mar-2021 08:01:46

13K+ Views

In this post, we will understand the difference between Link and Association.LinkIt can be understood as the physical connection between objects.It helps tell about the relationship among objects.It is represented using line segment between objects.They can’t be referenced.It is used in UML designs.AssociationIt is a specification about the collection of links.The connections are related to classes.It is a general relationship between classes.They are implemented using programming languages as a reference model.It shows connections between classes using line segments.It is used in UML designs.

Difference Between Friend Function and Friend Class

AmitDiwan
Updated on 23-Mar-2021 08:01:22

6K+ Views

In this post, we will understand the difference between Friend function and Friend class.Friend FunctionIt is usually used with operator overloading operation.It is used with the ‘friend’ keyword.It helps give a non-member function the access to the private members of the class.It has to be declared before it is used.It is used to access private and protected members of the class.It can be a global function or a function in another class.Exampleclass Node {    private:    int val;    Node* next;    // Other members of Node Class //    friend int LinkedList::search();    // Only search method ... Read More

Difference Between DDA and Bresenham Line Drawing algorithm

Kiran Kumar Panigrahi
Updated on 28-Jul-2022 12:19:02

16K+ Views

The realm of computer graphics is an expansive one that is always undergoing development. It involves a variety of concepts and ideas, of which "drawing a line" is the most fundamental tasks involved in working with graphical media.There are two algorithmic rules that are followed while drawing a line on the screen. They are DDA (Digital Differential Analyser) algorithmic rule and Bresenham line algorithm.Both the DDA and Bresenham's algorithm are examples of computational procedures that can be utilised for the goal of approximating the length of a line segment.What is DDA?The primary purpose of a DDA in computer graphics is ... Read More

Difference Between Server-side Scripting and Clientside Scripting

AmitDiwan
Updated on 23-Mar-2021 07:38:59

5K+ Views

In this post, we will understand the difference between server-side scripting and client-side scripting.Server-side ScriptingIt helps work with the back end.It doesn’t depend on the client.It runs on the web server.It helps provide a response to every request that comes in from the user/client.This is not visible to the client side of the application.It requires the interaction with the server for the data to be process.Server side scripting requires languages such as PHP, ASP.net, ColdFusion, Python, Ruby on Rails.It is considered to be a secure way of working with applications.It can be used to customize web pages.It can also be ... Read More

Difference Between Private and Protected in C++

Nishu Kumari
Updated on 03-Mar-2025 13:16:34

2K+ Views

In this article, we'll explain the difference between private and protected access specifiers in C++. Access specifiers in C++ control who can access the variables and functions inside a class. Two commonly used specifiers are private and protected. Private members are accessible only within the class, while protected members can be accessed by the class and its derived classes. We'll show how each specifier works in C++, especially with inheritance, using simple examples to make it easy to understand. Private Access Modifier When we declare a class member as private, it means that this member is only accessible within ... Read More

Advertisements