Remainder in C++

Smita Kapse
Updated on 30-Jul-2019 22:30:26

230 Views

Here we will see the functionality of remainder() method of C++. The remainder() function is used to compute the floating point remainder of numerator/denominator.So the remainder(x, y) will be like below.remainder(x, y) = x – rquote * yThe rquote is the value of x/y. This is rounded towards the nearest integral value. This function takes two arguments of type double, float, long double, and returns the remainder of the same type, that was given as argument. The first argument is numerator, and the second argument is the denominator.Example#include #include using namespace std; main() {    double x = ... Read More

wprintf and wscanf in C Library

Anvi Jain
Updated on 30-Jul-2019 22:30:26

2K+ Views

Here we will see the wprintf() and wscanf() functions in C. These are the printf() and scanf() functions for wide characters. These functions are present in the wchar.hThe wprintf() function is used to print the wide character to the standard output. The wide string format may contain the format specifiers which is starting with % sign, these are replaced by the values of variables which are passed to the wprintf().The syntax is like below −int wprintf (const wchar_t* format, ...);This function takes the format. This format is a pointer to a null terminated wide string, that will be written in ... Read More

Project Specific Array Field in a MongoDB Collection

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

253 Views

Let us first create a collection with documents −> db.projectionAnElementDemo.insertOne( ...    { ...       "CustomerId":100, ...       "CustomerDetails": [ ...          { ...             "CustomerName": "Chris", ...             "CustomerCountryName": "US" ...          }, ...          { ...             "CustomerName": "Robert", ...             "CustomerCountryName": "UK" ...          } ...       ] ...    } ... ); {    "acknowledged" : true,   ... Read More

Circular References and Memory Leakage in JavaScript

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

570 Views

Circular reference A circular reference is formed when two variables reference to each other there by giving each object a reference count of 1.In pure garbage collected system, a circular reference may not be a problem when the variables involved were have no references.In that scenario the declared variables will be garbage collected.In reference counting system neither of the objects will be destroyed, because the reference count cannot be zero.In hybrid system, where reference counting and garbage collection are used, memory leaks will occur because the system fails to identify circular references.ExampleThe following example shows a circular reference between javascript object ... Read More

Update Multiple Documents in MongoDB

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

456 Views

You need to use multi:true to update multiple documents. Let us first create a collection with documents −> db.multiUpdateDemo.insertOne({"ClientName":"John", "ClientAge":29}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5bc0b50a6c6dd317adc8") } > db.multiUpdateDemo.insertOne({"ClientName":"Carol", "ClientAge":31}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5bc1b50a6c6dd317adc9") } > db.multiUpdateDemo.insertOne({"ClientName":"John", "ClientAge":39}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5bc3b50a6c6dd317adca") } > db.multiUpdateDemo.insertOne({"ClientName":"John", "ClientAge":41}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5bc5b50a6c6dd317adcb") } > db.multiUpdateDemo.insertOne({"ClientName":"David", "ClientAge":35}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5bc6b50a6c6dd317adcc") }Following is the query to display all documents from a collection with the help of find() method −> db.multiUpdateDemo.find().pretty();This ... Read More

Calculate Area of Enneagon

Sharon Christine
Updated on 30-Jul-2019 22:30:26

174 Views

An enneagon also known as nonagon is a polygon with 9 sides. To calculate the area of enneagon the following formula is used, Area of ennagon = ((a2*9) / 4*tan (20°)) ∼= (6.18 * a2)Code Logic, The area of a polygon with nine sides is calculated by using the formula, ((a2*9) / 4*tan (20°)) ∼= (6.18 * a2). The value 6.18 is filled into a float variable called multiplier, this value then multiplied by the square of side of enneagon.Example Live Demo#include #include int main(){    int a = 6;    float area;    float multiplier = 6.18;   ... Read More

HTML DOM Input Date Readonly Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

201 Views

The HTML DOM Input Date readOnly property sets/returns whether Input Date can be modified or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputDateObject.readOnlySetting readOnly to booleanValueinputDateObject.readOnly = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that the input date is readOnly.falseIt defines that the input date is not readOnly and can be modified.ExampleLet us see an example of Input Date readOnly property − Live Demo Input Date readOnly Final Exam Date: Confirm Date    var divDisplay = document.getElementById("divDisplay");    var inputDate = document.getElementById("dateSelect");    divDisplay.textContent = 'Exam Date Finalized: '+inputDate.readOnly;   ... Read More

ABS, LABS, and LLABS Functions in C/C++

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

244 Views

In the cstdlib library of C++, there are different functions for getting the absolute value except from abs. The abs are used basically for int type input in C, and int, long, long long in C++. The others are used for long, and long long type data etc. Let us see the usage of these functions.The abs() FunctionThis function is used for int type data. So this returns the absolute value of the given argument. The syntax is like below.int abs(int argument)Example#include #include #include using namespace std; main() {    int x = -145;    int y = 145;    cout

Numeric Constant Prefix in C/C++

Smita Kapse
Updated on 30-Jul-2019 22:30:26

227 Views

Sometimes we may see some numeric literals, which is prefixed with 0. This indicates that the number is octal number. So octal literals contain 0 at the beginning. For example, if an octal number is 25, then we have to write 025.Example#include int main() {    int a = 025;    int b = 063;    printf("Decimal of 25(Octal) is %d", a);    printf("Decimal of 63(Octal) is %d", b); }OutputDecimal of 25(Octal) is 21 Decimal of 63(Octal) is 51

Check If a ResultSet is Closed in JDBC

Arushi
Updated on 30-Jul-2019 22:30:26

2K+ Views

Whenever we execute SQL statements using the executeQuery() method, it returns a ResultSet object which holds the tabular data returned by the SELECT queries(in general).The ResultSet object contains a cursor/pointer which points to the current row. Initially this cursor is positioned before first row (default position).The isClosed() method of the ResultSet interface is used to determine whether the current ResultSet object is closed.rs.isclosed()Let us create a table with name tutorials_data in MySQL database using CREATE statement as shown below −CREATE TABLE tutorials_data (    tutorial_id INT,    tutorial_title VARCHAR(100),    tutorial_author VARCHAR(40),    submission_date date,    PRIMARY KEY (tutorial_id) );Now, we will insert 5 ... Read More

Advertisements