Articles on Trending Technologies

Technical articles with clear explanations and examples

C# String Properties

AmitDiwan
AmitDiwan
Updated on 03-Dec-2019 910 Views

Following are the properties of the String class in C# −Sr.NoProperty & Description1CharsGets the Char object at a specified position in the current String object.2LengthGets the number of characters in the current String object.ExampleLet us see an example - Live Demousing System; public class Demo {    public static void Main() {       string str1 = "h8b9";       string str2 = "abcdef";       Console.WriteLine("Is string1 null or empty? = "+string.IsNullOrEmpty(str1));       Console.WriteLine("Is string2 null or empty? = "+string.IsNullOrEmpty(str2));       bool val = str1 != str2;       Console.WriteLine("Is str1 equal ...

Read More

TimeSpan.FromTicks() Method in C#

AmitDiwan
AmitDiwan
Updated on 03-Dec-2019 414 Views

The TimeSpan.FromTicks() method in C# is used to return a TimeSpan that represents a specified time, where the specification is in units of ticks.SyntaxThe syntax is as follows -public static TimeSpan FromTicks (long val);Above, the parameter val is the number of ticks that represent a time.ExampleLet us now see an example - Live Demousing System; public class Demo {    public static void Main() {       TimeSpan span1 = TimeSpan.FromTicks(18768768);       TimeSpan span2 = new TimeSpan(-9, 45, 50);       TimeSpan span3 = TimeSpan.FromHours(5);       TimeSpan span4 = TimeSpan.FromMilliseconds(10000);       TimeSpan span5 ...

Read More

C# BitConverter.ToUInt16() Method

AmitDiwan
AmitDiwan
Updated on 03-Dec-2019 428 Views

The BitConverter.ToUInt16() method in C# is used to return a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.Syntaxpublic static ushort ToUInt16 (byte[] val, int begnIndex);Above, val is the byte array, whereas begnIndex is the beginning position within val.ExampleLet us now see an example - Live Demousing System; public class Demo {    public static void Main() {       byte[] arr = { 10, 20, 30, 40, 50};       int count = arr.Length;       Console.Write("Byte Array... ");       for (int i = 0; i < count; i++) ...

Read More

TimeSpan.FromSeconds() Method in C#

AmitDiwan
AmitDiwan
Updated on 03-Dec-2019 4K+ Views

The TimeSpan.FromSeconds() method in C# is used to return a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.SyntaxThe syntax is as follows -public static TimeSpan FromSeconds (double val);Above, the parameter val is the number of seconds, accurate to the nearest millisecond.ExampleLet us now see an example - Live Demousing System; public class Demo {    public static void Main() {       TimeSpan span1 = TimeSpan.FromSeconds(0.6768788);       TimeSpan span2 = new TimeSpan(25, 15, 45);       TimeSpan span3 = TimeSpan.FromHours(.4788);       TimeSpan span4 = TimeSpan.FromMilliseconds(0.8787);   ...

Read More

TimeSpan.FromMinutes() Method in C#

AmitDiwan
AmitDiwan
Updated on 03-Dec-2019 2K+ Views

The TimeSpan.FromMinutes() method in C# is used to return a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.Syntaxpublic static TimeSpan FromMinutes (double val);Above, the value val is the number of minutes, accurate to the nearest millisecond.Example Live Demousing System; public class Demo {    public static void Main() {       TimeSpan span1 = TimeSpan.FromHours(0.78787);       TimeSpan span2 = new TimeSpan(10, 30, 40);       TimeSpan span3 = TimeSpan.FromHours(5);       TimeSpan span4 = TimeSpan.FromMilliseconds(1);       TimeSpan span5 = TimeSpan.FromMinutes(100);       Console.WriteLine("TimeSpan1 = ...

Read More

C++ Program to implement t-test

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 1K+ Views

In this tutorial, we will be discussing a program to implement t-test.The t-test of the student’s T test is used to compare two means and tell if both of them are similar or different. Along with this, t-test also helps to determine how large the differences are to know the reason for the change.Example#include using namespace std; //calculating mean float calc_mean(float arr[], int n){    float sum = 0;    for (int i = 0; i < n; i++)       sum = sum + arr[i];    return sum / n; } //calculating standard deviation float calc_deviation(float arr[], ...

Read More

C++ Program to implement standard error of mean

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 310 Views

In this tutorial, we will be discussing a program to implement standard error of mean.Standard error of mean is the estimation of sample mean dispersion from population mean. Then it is used to estimate the approximate confidence intervals for the mean.Example#include using namespace std; //calculating sample mean float calc_mean(float arr[], int n){    float sum = 0;    for (int i = 0; i < n; i++)       sum = sum + arr[i];    return sum / n; } //calculating standard deviation float calc_deviation(float arr[], int n){    float sum = 0;    for (int i = ...

Read More

C++ program to implement Simpson&rsquo;s 3/8 rule

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 1K+ Views

In this tutorial, we will be discussing a program to implement SImpson’s ⅜ rule.Simpson’s ⅜ rule is used for doing numerical integrations. The most common use case of this method is in performing numerical approximations of definite integrals.In this, the parabolas on the graph are used for performing the approximations.Example#include using namespace std; //function that is to be integrated float func_inte( float x){    return (1 / ( 1 + x * x )); } //calculating the approximations float func_calculate(float lower_limit, float upper_limit, int interval_limit ){    float value;    float interval_size = (upper_limit - lower_limit) / interval_limit;    float ...

Read More

C++ Program to implement Linear Extrapolation

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 989 Views

In this tutorial, we will be discussing a program to implement Linear Extrapolation.Extrapolation is defined as a process in which the required value for a certain function is beyond the lower or the upper limits of the function definition.In the case of Linear Extrapolation, the value beyond the scope is found using the tangent made on the graph of the function to determine the required value. Linear Extrapolation gives quite accurate results when applied.Example#include using namespace std; //structuring the values of x and y struct Data {    double x, y; }; //calculating the linear extrapolation double calc_extrapolate(Data d[], ...

Read More

C++ program to implement Inverse Interpolation using Lagrange Formula

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 488 Views

In this tutorial, we will be discussing a program to implement Inverse Interpolation using Lagrange formula.Inverse Interpolation is defined as the method of finding the value of an independent variable from the given value of dependent value lying between two tabulated set of values for an unknown function.Example#include using namespace std; //structuring the values of x and y struct Data {    double x, y; }; //calculating inverse interpolation double calc_invinter(Data d[], int n, double y){    double x = 0;    int i, j;    for (i = 0; i < n; i++) {       double ...

Read More
Showing 52891–52900 of 61,248 articles
Advertisements