Console.KeyAvailable() Property in C#

AmitDiwan
Updated on 14-Nov-2019 05:46:44

312 Views

The Console.KeyAvailable() property in C# is used to get a value indicating whether a key press is available in the input stream.SyntaxThe syntax is as follows −public static bool KeyAvailable { get; }ExampleLet us now see an example to implement the Console.KeyAvailable() property in C# −using System; using System.Threading; class Demo {    public static void Main (string[] args) {       ConsoleKeyInfo cs = new ConsoleKeyInfo();       do {          Console.WriteLine("Press a key to display; "+ "press the 'Q' key to quit.");          while (Console.KeyAvailable == false)Thread.Sleep(100);       ... Read More

Console Class in C#

AmitDiwan
Updated on 14-Nov-2019 05:41:46

1K+ Views

The Console class in C# is used to represent the standard input, output, and error streams for console applications.Let us see some examples of Console class properties in C# −Console.CursorLeft propertyTo change the CursorLeft of the Console in C#, use the Console.CursorLeft property.ExampleLet us see an example −using System; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.Yellow;       Console.WriteLine("Foreground color changed = "+Console.ForegroundColor);       Console.CursorLeft = 30;       Console.Write("CursorLeft position: "+Console.CursorLeft); ... Read More

Decimal Struct in C#

AmitDiwan
Updated on 14-Nov-2019 05:37:27

283 Views

The Decimal Struct in C# Represents a decimal floating-point number. The Decimal value type represents decimal numbers ranging from positive 79, 228, 162, 514, 264, 337, 593, 543, 950, 335 to negative 79, 228, 162, 514, 264, 337, 593, 543, 950, 335. The default value of a Decimal is 0.Let us now see some examples of the methods in Decimal Struct −Decimal.Add()The Decimal.Add() method in C# is used to add two specified Decimal values.SyntaxFollowing is the syntax −public static decimal Add (decimal val1, decimal val2);Above, va1 is the first decimal to add, whereas val2 is the second decimal to be ... Read More

UInt64 Struct in C#

AmitDiwan
Updated on 14-Nov-2019 05:34:04

319 Views

The UInt64 struct represents a 64-bit unsigned integer. The UInt64 value type represents unsigned integers with values ranging from 0 to 18, 446, 744, 073, 709, 551, 615.Let us now see some examples of UInt64 Struct methods −UInt64.CompareTo()The UInt64.CompareTo() method in C# is used to compare the current instance to a specified object or UInt64 and returns an indication of their relative values.SyntaxFollowing is the syntax −public int CompareTo (object val); public int CompareTo (ulong val;Above, the value for the 1st syntax is an object to compare. The value for 2nd syntax is an unsigned integer to compare.The return value ... Read More

Uri.IsWellFormedOriginalString() Method in C#

AmitDiwan
Updated on 14-Nov-2019 05:26:59

22 Views

The Uri.IsWellFormedOriginalString() method in C# indicates whether the string used to construct this Uri was well-formed and is not required to be further escaped.SyntaxFollowing is the syntax −public bool IsWellFormedOriginalString ();ExampleLet us now see an example to implement the Uri.IsWellFormedOriginalString() method −using System; public class Demo {    public static void Main(){       Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm");       Console.WriteLine("URI = "+newURI1);       Uri newURI2 = new Uri("https://www.qries.com/");       Console.WriteLine("URI = "+newURI2);       if(newURI1.Equals(newURI2))          Console.WriteLine("Both the URIs are equal!");       else       ... Read More

Uri.IsHexEncoding() Method in C#

AmitDiwan
Updated on 14-Nov-2019 05:24:17

17 Views

The Uri.IsHexEncoding() method in C# determines whether a character in a string is hexadecimal encoded.SyntaxFollowing is the syntax −public static bool IsHexEncoding (string pattern, int index);Above, the pattern parameter is the string to check, whereas the index is the location in pattern to check for hexadecimal encoding.ExampleLet us now see an example to implement the Uri.IsHexEncoding() method −using System; public class Demo {    public static void Main(){       string pattern = "%50";       bool res = Uri.IsHexEncoding(pattern, 0);       if (res)          Console.WriteLine("Valid: Hexadecimal Encoded");       else   ... Read More

Bash program to check if the Number is a Prime or not

sudhir sharma
Updated on 13-Nov-2019 11:53:01

17K+ Views

Bash also known as GNU bash is a command language and unix shell script is a command line interpreter for operating system. It was designed by Brian Fox and was a free software which replaced Bourne shell. It first released in 1989 and some became go to for login shell for linux based operating systems like macOS, Linux based softwares, etc.Prime number is a number that has only two factors i.e. the number itself and 1. For example, 2 , 3 , 5, 7 , 11 , 13 , 17 , 19 , 23 , 29….Here we are given a ... Read More

bar() function in C graphics

sudhir sharma
Updated on 13-Nov-2019 11:47:23

1K+ Views

bar() function is a C graphics function that is used to draw graphics in the C programming language. The graphics.h header contains functions that work for drawing graphics. The bar() function is also defined in the header file.Syntaxvoid bar(int left, int top, int right, int bottom );The bar() function is used to draw a bar ( of bar graph) which is a 2-dimensional figure. It is filled rectangular figure. The function takes four arguments that are the coordinates of (X, Y) coordinates of the top-left corner of the bar {left and top } and (X, Y) coordinates of the bottom-right ... Read More

Bands in Radio frequency Spectrum in C program

sudhir sharma
Updated on 13-Nov-2019 11:43:05

350 Views

Radio frequency (RF) is the oscillation of an A.C. current or an A.C. voltage or any other oscillating body in the frequency range of 20KHz to 300 GHz.Radio frequency spectrum of a device is the frequency range that the device can capture, process or repercate. Generally the frequency range is 20Hz to 20KHz.A band is a frequency range that is divided from very low frequency to extremely high frequency. These bands are small ranges of frequency that are used to provide small parts of the spectrum.Bands In Radio Frequency SpectrumFrequency Range is range of continuous that has an upper limit ... Read More

C++ Balanced expressions such that given positions have opening brackets

sudhir sharma
Updated on 13-Nov-2019 11:30:34

146 Views

A balanced expression of parentheses is an expression that contains pairs of all sort of parentheses together in a correct order. this means that for every opening parentheses there is a closing parentheses in proper order of parentheses i.e. { }.Expression − {([][]{})({}[]{})}Output − balancedNow, in this problem we have to create all possiblebalanced expressions from the given number of brackets.And the condition is that the given position have opening brackets.In this problem, we are given an integer n and an array of position of the brackets of length 2n and we have to find the number of balanced expressions ... Read More

Advertisements