
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

16K+ Views
The fibonacci series contains numbers in which each term is the sum of the previous two terms. This creates the following integer sequence −0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377…….The recurrence relation that defines the fibonacci numbers is as follows −F(n) = F(n-1) + F(n-2) F(0)=0 F(1)=1Programs to Display Fibonacci SeriesThere are two methods to display fibonacci series i.e. using dynamic programming and recursive programming. These are further explained as follows −Dynamic ProgrammingExample#include using namespace std; void fib(int n) { int f[n]; int i; f[0] = 0; f[1] ... Read More

1K+ Views
Set the string −string str = "Cookie and Session";Use the following Regex to get the last 2 characters from string −Regex.Match(str,@"(.{2})\s*$")The following is the code −Example Live Demousing System; using System.Text.RegularExpressions; public class Demo { public static void Main() { string str = "Cookie and Session"; Console.WriteLine(Regex.Match(str,@"(.{2})\s*$")); } }Outputon

2K+ Views
In this article, we will show you the difference between C/C++ pointers and Java references. C/C++ use pointers to manually control how memory is used and accessed. Java, on the other hand, does not support pointers and uses references instead, which manage memory automatically. Pointer in C/C++ A pointer is a variable that holds the address of another variable in memory. It gives you direct access to that memory, which is powerful but can lead to errors if not used carefully. Syntax Here's the syntax where we declare a pointer with an asterisk(*) ... Read More

545 Views
A dictionary in Python is a collection of key-value pairs where each key must be unique. The lists, which are indexed by numbers, are accessed using keys that can be immutable types, strings, numbers, or tuples. Lists cannot be used as keys because they can be modified. Dictionaries are created using {}, and key-value pairs are added with commas. We can store, retrieve, and delete values using their keys. Using the list() returns all keys, while sorting them. To check if a key exists, we can use the in keyword. If a key is replaced, then its old value is replaced. ... Read More

414 Views
the main() method in Java code is itself inside a class. The static keyword lets the main() method which is the entry point of execution without making an object but you need to write a class. In C++, main() is outside the class and writing class it self is not mandatory. Hence, C++ is not a pure object oriented language bu Java is a completely object oriented language.

342 Views
Argument-dependent lookup(ADL) is a protocol for looking up unqualified function names in function-call expressions.These function call expressions include implicit function calls to overloaded operators.The function names are looked up in the namespaces of their arguments in addition to the scopes and namespaces considered by the usual unqualified name lookup. Argument-dependent lookup makes it possible to use operators defined in a different namespace. Examplenamespace MyNamespace{ class A {}; void f( A &a, int i) {} } int main() { MyNamespace::A a; f( a, 0 ); //calls MyNamespace::f }The lookup of a function call to f was dependent ... Read More

2K+ Views
The Standard Template Library (STL) is a software library for the C++ programming language that influenced many parts of the C++ Standard Library. It provides four components called algorithms, containers, functions, and iterators. Note that the term "STL" or "Standard Template Library" does not show up anywhere in the ISO 14882 C++ standard. So referring to the C++ standard library as STL is wrong, ie, STL and C++ Standard Library are 2 different things with the former being the subset of the latter.The STL consists ofContainersThe STL contains sequence containers and associative containers. Containers are objects that store data. The ... Read More

132 Views
new is used for dynamic memory allocation. The memory allocated in this case goes on the heap. There are several costs associated with this type of memory allocation along with the programmer having to do manual memory cleaning and management. This type of allocation must be used when − You don't know how much memory you need at compile time.You want to allocate memory which will persist after leaving the current block.Other than these, there are very few cases where dynamic memory allocation is required. This is because, in C++, there is the concept of a destructor. This function gets called ... Read More

2K+ Views
A translation unit is any preprocessed source file.A translation unit is the basic unit of compilation in C++. This unit is made up of the contents of a single source file after it passes through preprocessing. It contains included any header files without blocks that are ignored using conditional preprocessing statements like ifdef, ifndef, etc.A single translation unit can be compiled into an object file, library, or executable program.

15K+ Views
This is a simple way to read whole ASCII file into std::string in C++ − Algorithm Here is the algorithm we will follow to Read the whole ASCII file into C++ std::string. Begin Declare a file a.txt using file object f of ifstream type to perform a read operation. Declare a variable str of string type. If(f) Declare another variable ss of ostringstream type. Call rdbuf() function to read the data of the file object. Put the ... Read More