Server Side Programming Articles - Page 2181 of 2650

Add two numbers using ++ operator in C++.

Nishu Kumari
Updated on 25-Jul-2025 12:41:43

886 Views

Adding two numbers is a basic arithmetic operation, where we simply combine their values to get the total. The given task is to add two numbers using the "++" operator in C++. Let's understand this with an example: Scenario 1 // Adding two numbers using '+' operator Input: a = 7, b = 3 Output: 10 Explanation: a + b => 7 + 3 = 10 Scenario 2 // Adding two numbers using '++' operator Input: a = 7, b = 3 Output: 10 Explanation: a + b => 7 + 1 + ... Read More

Add two numbers represented by two arrays in C Program

sudhir sharma
Updated on 19-Sep-2019 08:18:23

2K+ Views

A number represented by the array is stored in such a form that each digit of the number is represented by an element of the array. For example, Number 234 in array is {2, 3, 4}.To add to such numbers we will first add number at the least significant digit and if the sum is greater than 10 propagate the carry. After this, we will go for the next consecutive digits of the array doing the same procedure and finding the sum.Let’s take an example to add two numbers −a = {2, 9, 6} b = {6, 3, 8} Output: ... Read More

C/C++ Tricky Programs

sudhir sharma
Updated on 19-Sep-2019 08:11:14

5K+ Views

Here are 10 tricky programs that will test your programming basics.1. Program to print “ ” in C++In C++ programming language, we use quotes to denote the start and end of the text is to be printed. So, printing quotes “ needs a special escape sequence. So, we will use the \” to print quotes in c++.Example Live Demo#include using namespace std; int main() {    cout

C/C++ Program for Greedy Algorithm to find Minimum number of Coins

sudhir sharma
Updated on 19-Sep-2019 08:02:59

6K+ Views

A greedy algorithm is an algorithm used to find an optimal solution for the given problem. greedy algorithm works by finding locally optimal solutions ( optimal solution for a part of the problem) of each part so show the Global optimal solution could be found.In this problem, we will use a greedy algorithm to find the minimum number of coins/ notes that could makeup to the given sum. For this we will take under consideration all the valid coins or notes i.e. denominations of { 1, 2, 5, 10, 20, 50 , 100, 200 , 500 ,2000 }. And we ... Read More

C++ vs C#

sudhir sharma
Updated on 19-Sep-2019 07:57:35

331 Views

C++ Programming languageA successor of the c programming language that has introduced the concept of classes and objects. It encapsulates features of c and high-level language hence it can be treated as an intermediate-level language. When it was created it was thought of as a C that has classes because of its similarities with C.C# Programming LanguageC# (also known as C sharp) is a general-purpose programming language that was developed by Microsoft to run on .net framework for developing applications for its operating system. It is an object-oriented programming language with features like object-oriented, statically typed, decorative, multiparadigm programming language.Both ... Read More

C++ Stream Classes Structure

sudhir sharma
Updated on 26-Oct-2023 03:24:39

27K+ Views

In C++ stream refers to the stream of characters that are transferred between the program thread and i/o.Stream classes in C++ are used to input and output operations on files and io devices. These classes have specific features and to handle input and output of the program.The iostream.h library holds all the stream classes in the C++ programming language.Let's see the hierarchy and learn about them, Now, let’s learn about the classes of the iostream library.ios class − This class is the base class for all stream classes. The streams can be input or output streams. This class defines members that ... Read More

C++ program to print unique words in a file

sudhir sharma
Updated on 19-Sep-2019 07:39:36

557 Views

A file is a memory location that stores word streams. In a file, there are various words. In this program, we will find all unique words from the file and print them.A unique word means the number of occurrences of the word is one in the file.For example, Tutorials point is best for programming tutorials.Here, the word tutorial occurs more than once, hence it is not unique. Rest all words are unique.AlgorithmTo check for unique words in the given file. Using iterator with two variables : data and occurence. Input : File Step 1 : Read each line from the ... Read More

C++ Program to print current Day, Date and Time

sudhir sharma
Updated on 19-Sep-2019 07:35:01

2K+ Views

Current day, date and time are all calendar dates that are printed on screen. In c++, the ctime library contains all the methods and variables related to date and time.You can also check current date and time details using the ctime library which contains methods to display time. The following methods are used to display details of date and time −time() − The time() method is used to find the current time. The return time of the time() method is time_t. time_t is the data type that can store time.localtime() − To convert the time_t type variables to a variable ... Read More

C++ program to find the type of the given iterator

sudhir sharma
Updated on 19-Sep-2019 07:30:27

230 Views

An iterator is an object just like a pointer that is used to iterate over elements of a container. The main advantage of using an iterator is to create a common interface and make the algorithm immune from the type of container used to implement it.In C++ standard library there are Types of iterators −Forward iteratorBidirectional iteratorInput iteratorOutput iteratorRandom Access iteratorThe program is to check which of the above iterators are used by the data structure.There are a few factors that can be useful for determining the type of iterator used.typeid, returns the type identification information at runtime.iterator traits, defines ... Read More

C++ program for Sorting Dates using Selection Sort

sudhir sharma
Updated on 19-Sep-2019 07:27:31

988 Views

Date is number day, month and year. There are various ways to display a date.Here, we have a program to sort dates using selection sort. So let's learn about things that are used in this concept.Sorting datesThe concept of sorting dates needs a clear and well-versed knowledge of dates and their validations. Before we try sorting technique we need to check if the date inputted by the user is a valid date of not like 29-2 is only valid for leap years.After validation of dates comes the sorting of dates. For sorting, we will go in reverse order sorting years ... Read More

Advertisements