Server Side Programming Articles - Page 2080 of 2650

C program to delete a file

sudhir sharma
Updated on 22-Nov-2019 07:40:35

3K+ Views

In programming, working with files is very important and every programming language has its own set of functions or library that help in manipulation of files.In C Programming Language also there is a function remove which can be used by the programmer to delete a file.remove() function in c programmingThe remove function is used to delete the file whose name is specified. This function is in the stdio header file.Syntaxremove (“file_name”);ParametersThe function accepts one parameter which is the name of the file that is to be deleted.File name can also be the path to the file but only if the ... Read More

BFS for Disconnected Graph in C++

sudhir sharma
Updated on 22-Nov-2019 07:37:46

954 Views

Disconnected graph is a Graph in which one or more nodes are not the endpoints of the graph i.e. they are not connected.A disconnected graph…Now, the Simple BFS is applicable only when the graph is connected i.e. all vertices of the graph are accessible from one node of the graph. in the above disconnected graph technique is not possible as a few laws are not accessible so the following changed program would be better for performing breadth first search in a disconnected graph.Example#include using namespace std; void insertnode(vector adj[], int u, int v) {    adj[u].push_back(v); } void breathFirstSearch(int u, ... Read More

Best meeting point in 2D binary array in C++

sudhir sharma
Updated on 22-Nov-2019 07:32:49

234 Views

In this problem, we are given a 2D binary array i.e. it has values that are either 0 or 1, where 1 is marked as a home of a person of the group. And people of the group want to meet. So, they need to minimise the total distance travelled by them for meeting at a common point. A valid meeting point can be anywhere but not at anyone home.For find minimum distance a formula is created, this is named as manhattan distance, where distance −(p1, p2) = |p2.x| + |p2.y - p1.y|.Let’s take an example, to make the concept ... Read More

Best First Search (Informed Search)

sudhir sharma
Updated on 22-Nov-2019 07:29:28

6K+ Views

Best first search is a traversal technique that decides which node is to be visited next by checking which node is the most promising one and then check it. For this it uses an evaluation function to decide the traversal.This best first search technique of tree traversal comes under the category of heuristic search or informed search technique.The cost of nodes is stored in a priority queue. This makes implementation of best-first search is same as that of breadth First search. We will use the priorityqueue just like we use a queue for BFS.Algorithm for implementing Best First SearchStep 1 ... Read More

Bell Numbers - Number of ways to Partition a Set in C++

sudhir sharma
Updated on 22-Nov-2019 07:24:12

878 Views

A bell number is used to denote the number of ways a set of n elements can be partitioned into subsets that are not empty (i.e. have at least one element).In this program, we are given a set of n elements and we have to find the number of ways to partition the set into non-empty subsets.ExampleInput : 3 Output : 5Explanation − let the set of three elements {1, 2, 3}.The subsets are {{1} , {2} , {3}} ; {{1} , {2, 3}} ; {{1 , 2} , {3}} ; {{2} , {1 , 3}} ; {1 , 2 , 3}.Bell ... Read More

Basic Operators in Shell Scripting

sudhir sharma
Updated on 22-Nov-2019 07:19:26

18K+ Views

Shell is an interface using which the programmer can execute command and interact directly to the operating system. Shell scripting is giving commands that a shell can execute.In shell also there are variables and operators that are used to manipulate these variables. There are 5 basic operators in shell scripting.Arithmetic OperatorsRelational OperatorsBoolean OperatorsBitwise OperatorsFile Test OperatorsArithmetic OperatorsArithmetic operators in shell scripting are used to perform general arithmetic/ mathematical operations. There are 7 valid arithmetic operators in shell scripting −Addition (+) is used to add two operands (variables).Subtraction (-) is used to subtract two variables (operands) in shell scripting.Multiplication (*) is ... Read More

Basic Operators in Relational Algebra

sudhir sharma
Updated on 22-Nov-2019 07:13:33

5K+ Views

Relational Algebra is a procedural query language, it is used to provide a single table / relation as output of performing operations on more than one relations. Some of the basic relations will be discussed here.In our course of learning, we will use three relations (table) −Table 1: courseCourse_idName1Computer science2Information Technology3mechanicalTable 2: studentsRoll No.Nameaddressage1RamDelhi182Rajuhyderabad204FaizDelhi225Salmanhyderabad20Table 3: HostelSt. No.Nameaddressage1RamDelhi182Akashhyderabad203nehaJhansi21On this relations, we will perform some operation to make new relation based on operations performed.Selection operation (σ) − The selection operator denoted by sigma σ is used to select the tuples of a relation based on some condition. Only those tuples that fall ... Read More

Basic Graphic Programming in C++

sudhir sharma
Updated on 22-Nov-2019 07:06:43

21K+ Views

C++ programming language is a versatile programming language. Using C++ you can create low end graphics too i.e. creating basic shapes and words with stylish fonts and adding colors to them can be done using c++.Graphic programming can be done in c++ using your terminal or command prompt or you can download DevC++ compiler to create graphic programs.For terminal you need to add the graphics.h libraray to you GCC compiler. For this you will have type in the following commands.>sudo apt-get install build-essential >sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-2.0 \ guile-2.0-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev \ libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev \ ... Read More

Basic Concepts of Object Oriented Programming using C++

sudhir sharma
Updated on 02-Sep-2023 15:38:57

49K+ Views

Object oriented programming is a type of programming which uses objects and classes its functioning. The object oriented programming is based on real world entities like inheritance, polymorphism, data hiding, etc. It aims at binding together data and function work on these data sets into a single entity to restrict their usage.Some basic concepts of object oriented programming are −CLASSOBJECTSENCAPSULATIONPOLYMORPHISMINHERITANCEABSTRACTIONClass − A class is a data-type that has its own members i.e. data members and member functions. It is the blueprint for an object in object oriented programming language. It is the basic building block of object oriented programming in ... Read More

C++ program to find the sum of the series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n

Ayush Gupta
Updated on 09-Jul-2020 08:51:51

822 Views

In this tutorial, we will be discussing a program to find the sum of the given series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n.For this, we will be given with the value of n and our task is to add up every term starting from the first one to find the sum of the given series.Example#include #include using namespace std; //calculating the sum of the series double calc_sum(int n) {    int i;    double sum = 0.0, ser;    for (i = 1; i

Advertisements