Anvi Jain has Published 629 Articles

MySQL format time with lowercase am/pm?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

585 Views

To format MySQL time with lowercase am/pm, use the LOWER() as well as DATE_FORMAT().Let us first create a table −mysql> create table formatTime    -> (    -> LoginTime time    -> ); Query OK, 0 rows affected (0.56 sec)Following is the query to insert records in the table using ... Read More

Benefits of inline functions in C++?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

758 Views

C++ inline function is a powerful concept that is commonly used with classes. If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time.Any change to an inline function could require all clients of ... Read More

What do single quotes do in C++ when used on multiple characters?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

779 Views

In C++ thIn C++ the double quotes are used as string literals, and single quote with one character is used as character literals. Now here we will see what will be the output if we try to print a multi-character string using the single quote.Example Code Live Demo#include using namespace std; ... Read More

C++ program to Check if a Given Binary Tree is an AVL Tree or Not

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

2K+ Views

AVL tree is a self-balancing Binary Search Tree where the difference between heights of left and right subtrees cannot be more than one for all nodes.This is a C++ program to check if a given Binary Tree is an AVL Tree or not.AlgorithmBegin function AVL() returns true if the given ... Read More

What is a virtual base class in C++?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

1K+ Views

The virtual base class is used when a derived class has multiple copies of the base class.Example Code#include using namespace std; class B {    public: int b; }; class D1 : public B {    public: int d1; }; class D2 : public B {   ... Read More

Reorder integer except for value 0 with MySQL?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

55 Views

To reorder integer except for value 0, use the below syntax −select *from yourTableName order by yourColumnName=0 ,yourColumnName;Let us first create a table −mysql> create table reorderIntegerExcept0    -> (    -> value int    -> ); Query OK, 0 rows affected (0.70 sec)Following is the query to insert records ... Read More

How to generate different random numbers in a loop in C++?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

4K+ Views

Let us see how to generate different random numbers using C++. Here we are generating random numbers in range 0 to some value. (In this program the max value is 100).To perform this operation we are using the srand() function. This is in the C++ library. The function void srand(unsigned ... Read More

Why do we need a pure virtual destructor in C++?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

699 Views

There are no ill-effects of allowing a pure virtual destructor in C++ program. It is must to provide a function body for pure virtual destructor as derived class’s destructor is called first before the base class destructor, so if we do not provide a function body, it will find out ... Read More

C++ Program to Implement Direct Addressing Tables

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

490 Views

This is a C++ program to implement Direct Addressing Tables. Direct Addressing Tables are used when each element has a key drawn from a universal set S = {0, 1, . . . ,n − 1} where n isn’t too large and each key is unique. It facilitates fast insertion, ... Read More

Variadic function templates in C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

230 Views

Variadic function templates in C++ is a function which can take a multiple number of arguments.Syntaxtemplate(typename arg, typename... args) return_type function_name(arg var1, args... var2)Example Code Live Demo#include using namespace std; void show() //base case. {    cout

Advertisements