What is the use of cin.ignore() in C++?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25
The cin.ignore() function is used which is used to ignore or clear one or more characters from the input buffer.To get the idea about ignore() is working, we have to see one problem, and its solution is found using the ignore() function. The problem is like below.Sometimes we need to clear the unwanted buffer, so when next input is taken, it stores into the desired container, but not in the buffer of previous variable. For example, after entering into the cin statement, we need to input a character array or string. So we need to clear the input buffer, otherwise ... Read More

Does Ternary operation exist in MySQL just like C or C++?

Samual Sam
Updated on 30-Jul-2019 22:30:25
Yes, let us first see the working of ternary operator in C or C++ language.X=(X > 10 && ( X-Y) < 0) ?: X:(X-Y);Here is the demo code in C language. After that we will check in MySQL. The C code is as follows −#include int main() {    int X;    int Y;    int result;    printf("Enter the value for X:");    scanf("%d", &X);    printf("Enter the value for Y:");    scanf("%d", &Y);    result=( X > 1 && (X-Y) < 0) ? X: (X-Y);    printf("The Result is=%d", result);    return 0; }The snapshot of C ... Read More

Multiplexer/demultiplexer in 8085 Microprocessor

Arjun Thakur
Updated on 30-Jul-2019 22:30:25
Let us consider the instruction to be executed as “MOV A, C”. Here in this case the value of 8 bit in the register C must be moved to the register. The given set of registers namely B, C, D, E, H, and L must be connected to the internal bus by means of a multiplexer (many input but only one output) or demultiplexer the reverse of multiplexer. The register meant to carry the work selects the specific unit and sends the appropriate code to the multiplexer such that the contents of register C are sent out to the multiplexer ... Read More

How to use Bubble chart graph in android?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25
This example demonstrate about How to use Bubble chart graph in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Open build.gradle(module level) and add library dependency.apply plugin: 'com.android.application' android {    packagingOptions {       exclude 'META-INF/proguard/androidx-annotations.pro'    }    packagingOptions {       exclude 'META-INF/DEPENDENCIES'       exclude 'META-INF/LICENSE'       exclude 'META-INF/LICENSE.txt'       exclude 'META-INF/license.txt'       exclude 'META-INF/NOTICE'       exclude 'META-INF/NOTICE.txt'       exclude 'META-INF/notice.txt'     ... Read More

How to insert new documents into a MongoDB collection in your database?

Daniol Thomas
Updated on 30-Jul-2019 22:30:25
To insert new documents into a MongoDB collection, you need to use insert() method or save() method.Case 1: Using insert() method.The syntax is as follows:db.yourCollectionName.insert(yourDocument);Case 2: Using save() method.The syntax is as follows:db.yourCollectionName.save(yourDocument);In the above syntax, if your collection name does not exist then MongoDB will create a new collection and insert the document in the collection.The query to insert new documents is as follows for both the cases discussed above.Case 1: Using insert() method. The query is as follows:> db.userInformation.insert({    ... "Name":"John",    ... Age:30,    ... isStudent:false,    ... "Subjects":["Introduction to java", "Introduction to MongoDB"]    ... ... Read More

Create a new user with password in MySQL 8?

Arjun Thakur
Updated on 30-Jul-2019 22:30:25
You need to use CREATE command to create a new user with password in MySQL 8. Let us check the versionmysql> select version(); +-----------+ | version() | +-----------+ | 8.0.12    | +-----------+ 1 row in set (0.14 sec)The syntax is as follows to create a new user with passwordCREATE USER 'yourUserName'@'localhost' IDENTIFIED BY 'yourPassword';The following is the syntax to grant all privileges to the created userGRANT ALL ON *.* TO 'yourUserName'@'localhost';Now flush the privileges using flush commandflush privileges; Let us create a new user with the help of the above syntax. The query is as followsmysql> use MySQL; Database ... Read More

What are JSTL formatting tags in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
The JSTL formatting tags are used to format and display text, the date, the time, and numbers for internationalized Websites. Following is the syntax to include Formatting library in your JSP −Following table lists out the Formatting JSTL Tags −S.No.Tag & Description1: To render numerical value with specific precision or format.2: Parses the string representation of a number, currency, or percentage.3: Formats a date and/or time using the supplied styles and pattern.4: Parses the string representation of a date and/or time5: Loads a resource bundle to be used by its tag body.6: Stores the given locale in the locale configuration variable.7: Loads a resource bundle and ... Read More

LocalDate withDayOfMonth() method in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
An immutable copy of a LocalDate with the day of month altered as required is done using the method withDayOfMonth() in the LocalDate class in Java. This method requires a single parameter i.e. the day of month that is to be set in the LocalDate and it returns the LocalDate with the day of month altered as required.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main {    public static void main(String[] args) {       LocalDate ld1 = LocalDate.parse("2019-02-15");       System.out.println("The LocalDate is: " + ld1);     ... Read More

Create Octet Tuple from another collection in Java

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25
You can create Octel Tuple from another collection i.e. List or arrays. For List, use the fromCollection() method.Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package −import org.javatuples.Octet;Note: Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples −Steps: How to run JavaTuples program in EclipseThe following is an ... Read More

Replace substring with another substring C++

Nitya Raut
Updated on 30-Jul-2019 22:30:25
Here we will see how to replace substring with another substring. It replaces the portion of the string that begins at character pos and spans len characters.The structure of the replace function is like below:string& replace (size_t pos,  size_t len,  const string& str,  size_t subpos,  size_t sublen);The parameters are pos: It is an insertion point, str : It is a string object, len : It contains information about number of characters to erase.AlgorithmStep 1: Get the main string, and the string which will be replaced. And the match string Step 2: While the match string is present in the main string: Step 2.1: Replace it with the given ... Read More
Advertisements