asin Function for Complex Number in C++

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26

173 Views

Here we will see the asin() method for the complex numbers. The complex numbers can be used using complex header file. In that header file the asin () function is also present. This is complex version of normal asin () function. This is used to find complex arc sine of a complex number.This function takes a complex number as input parameter, and returns the arc sine as output. Let us see one example to get the idea.Example Live Demo#include #include using namespace std; int main() {    complex c1(5, 2);    //asin() function for complex number    cout

Add JList to Scroll Pane in Java

Krantik Chavan
Updated on 30-Jul-2019 22:30:26

1K+ Views

To add JList to Scroll pane in Java, use JScrollPane:JList list = new JList(sports); JScrollPane scrollPane = new JScrollPane(list);After that set it to Container:Container contentPane = frame.getContentPane(); contentPane.add(scrollPane, BorderLayout.CENTER);The following is an example to add JList to Scroll pane:Examplepackage my; import java.awt.event.*; import java.awt.*; import javax.swing.*; class SwingDemo extends JFrame {    static JFrame frame;    static JList list;    public static void main(String[] args) {       frame = new JFrame("JList Demo");       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       String sports[]= {"Tennis", "Archery", "Football", "Fencing", "Cricket", "Squash", "Hockey", "Rugby"};       list = new JList(sports);     ... Read More

Include Libraries in Visual Studio 2012

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

1K+ Views

To add libraries in Visual Studio 2012, there are two different methods. The first one is manual method. The second one is adding libraries from code.Let us see the manual method first.To add some library, we have to follow these five steps −Add the #include statements necessary files with proper declarations. For example −#include “library.h”Add the include directory for the compiler look up;Go to the Configuration Properties/VC++ Directories/Include DirectoriesThen click and edit, and add new entryAdd one library directory for *.lib files:Go to project (on top bar) -> properties -> Configuration Properties -> VC++ Directories -> Library Directories, then click ... Read More

Java Connection getNumeric Method with Example

Vikyath Ram
Updated on 30-Jul-2019 22:30:26

218 Views

The getNumeric() method of the Connection interface retrieves the list of math functions supported by the current database. The names returned by this method are the Open CLI math function names.This method returns a String value holding the list of functions separated by commas (", ").To get the list of the numeric functions supported by the underlying database −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the ... Read More

Combine Update and Query Parts to Form Upserted Document in MongoDB

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

188 Views

You need to use $set operator along with upsert:true. Let us first create a collection with documents −> db.updateWithUpsertDemo.insertOne({"StudentFirstName":"John", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2a61c345990cee87fd890") } > db.updateWithUpsertDemo.insertOne({"StudentFirstName":"Larry", "StudentAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2a624345990cee87fd891") } > db.updateWithUpsertDemo.insertOne({"StudentFirstName":"David", "StudentAge":24}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2a62c345990cee87fd892") }Following is the query to display all documents from a collection with the help of find() method −> db.updateWithUpsertDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cd2a61c345990cee87fd890"),    "StudentFirstName" : "John",    "StudentAge" : 21 } {    "_id" : ObjectId("5cd2a624345990cee87fd891"),    "StudentFirstName" ... Read More

Set Column Selection in Table Model in Java

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

81 Views

We can set or disallow selection of column in the table using setColumnSelectionAllowed().Let’s say the following is our table −DefaultTableModel tableModel = new DefaultTableModel(); JTable table = new JTable(tableModel);If you want to allow selection of column, then set the method to TRUE −table.setColumnSelectionAllowed(true);If you want to disallow selection of column, then set the method to FALSE −table.setRowSelectionAllowed(false);Here, in the below example we have disallowed selection of columns −Examplepackage my; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class SwingDemo {    public static void main(String[] argv) throws Exception {       DefaultTableModel tableModel = new DefaultTableModel();     ... Read More

Create Message Pop-Ups with Java

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

710 Views

To create Message Pop-ups, use the following JOptionPane −JOptionPane.showMessageDialogWe are displaying a tree inside the message pop-ups. The following is an example to create Message Pop-Ups with Java −Examplepackage my; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; public class SwingDemo {    public static void main(String[] args) throws Exception {       JFrame frame = new JFrame("Demo");       DefaultMutableTreeNode node = new DefaultMutableTreeNode("Project");       DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("App");       DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("Website");       DefaultMutableTreeNode node3 = new DefaultMutableTreeNode("WebApp");       node.add(node1);       ... Read More

Add Two Weeks to a Date in MySQL

Chandu yadav
Updated on 30-Jul-2019 22:30:26

796 Views

To add two weeks to a date in MySQL, use DATE_ADD() −insert into yourTableName(yourColumnName) values(date_add(now(), interval 2 week));Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate datetime    ); Query OK, 0 rows affected (0.62 sec)Following is the query to get the current date −mysql> select now(); +-----------------------+ | now() | +-----------------------+ | 2019-06-02 10 :36 :49 | +-----------------------+ 1 row in set (0.00 sec)Insert some records in the table using ... Read More

C++ Program to Solve Travelling Salesman Problem for Unweighted Graph

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

4K+ Views

Travelling Salesman Problem use to calculate the shortest route to cover all the cities and return back to the origin city. This method is use to find the shortest path to cover all the nodes of a graph.This is the program to find shortest route of a unweighted graph.AlgorithmBegin    Define a variable vr = 4 universally.    Declare an integer function TSP to implement Travelling salesman Problem.    Declare a graph grph[][] as a 2D matrix and variable p to the integer datatype.    Pass them as a parameter.    Declare variable ver to the vector datatype.    for ... Read More

Atan Function for Complex Number in C++

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26

174 Views

Here we will see the atan() method for the complex numbers. The complex numbers can be used using complex header file. In that header file the atan() function is also present. This is complex version of normal atan() function. This is used to find complex arc tan of a complex number.This function takes a complex number as input parameter, and returns the arc tan as output. Let us see one example to get the idea.Example Live Demo#include #include using namespace std; int main() {    complex c1(5, 2);    //atan() function for complex number    cout

Advertisements