
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

814 Views
In this tutorial, we will be discussing a program to generate CAPTCHA and verify user.For this, we will provide the user with a random string and ask him to reenter the same string. Then it has to be checked if the given and the input string matches.The CAPTCHA should be completely random system generated consisting of a-z, AZ and 0-9.Example#include using namespace std; //checks if the strings are same bool check_string(string &captcha, string &user_captcha){ return captcha.compare(user_captcha) == 0; } //generates a random string as Captcha string gen_captcha(int n){ time_t t; srand((unsigned)time(&t)); char *chrs = "abcdefghijklmnopqrstuvwxyzABCDEFGHI" "JKLMNOPQRSTUVWXYZ0123456789"; ... Read More

2K+ Views
The StringBuilder.ToString() method in C# is used to convert the value of a StringBuilder to a String.SyntaxThe syntax is as follows −public override string ToString (); public string ToString (int begnIndex, int len);Above, the parameter begnIndex is the starting position of the substring in this instance, whereas len is the length of the substring.ExampleLet us now see an example − Live Demousing System; using System.Text; public class Demo{ public static void Main(){ StringBuilder strBuilder = new StringBuilder("Katie"); Console.WriteLine("String = "+strBuilder.ToString()); Console.WriteLine("StringBuilder capacity = "+strBuilder.Capacity); Console.WriteLine("StringBuilder length = "+strBuilder.Length); ... Read More

3K+ Views
The Random.Next() method in C# is used to return a non-negative random integer.SyntaxThe syntax is as follows −public virtual int Next (); public virtual int Next (int maxVal);Above, the maxVal parameter is the exclusive upper bound of the random number to be generated.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(){ Random r = new Random(); Console.WriteLine("Random numbers....."); for (int i = 1; i

176 Views
The SortedDictionary.Value property in C# is used to get a collection containing the values in the SortedDictionary.SyntaxThe syntax is as follows −public System.Collections.Generic.SortedDictionary.ValueCollection Values { get; }ExampleLet us now see an example − Live Demousing System; using System.Collections; using System.Collections.Generic; public class Demo { public static void Main(){ SortedDictionarysortedDict = new SortedDictionary(); sortedDict.Add(1, "Ultrabook"); sortedDict.Add(2, "Alienware"); sortedDict.Add(3, "Notebook"); sortedDict.Add(4, "Connector"); sortedDict.Add(5, "Flash Drive"); sortedDict.Add(6, "SSD"); sortedDict.Add(7, "HDD"); sortedDict.Add(8, "Earphone"); Console.WriteLine("SortedDictionary ... Read More

65 Views
The Double.IsNegativeInfinity() method in C# is used to return a value indicating whether the specified number evaluates to negative infinity.SyntaxThe syntax is as follows −public static bool IsNegativeInfinity (double val);Above, val is a double-precision floating-point number.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(){ double d = 0.0/0; Console.WriteLine("Double Value = "+d); Console.WriteLine("HashCode of Double Value = "+d.GetHashCode()); TypeCode type = d.GetTypeCode(); Console.WriteLine("TypeCode of Double Value = "+type); Console.WriteLine("Positive Infinity? = "+Double.IsInfinity(d)); ... Read More

85 Views
The Boolean.GetTypeCode() method in C# is used to return the type code for the Boolean value type.SyntaxThe syntax is as follows −public TypeCode GetTypeCode ();ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(String[] args){ string str = "JackSparrow!"; bool val = true; char[] arr = { 'J', 'a'}; Console.WriteLine("String = "+str); Console.WriteLine("String (after trim) = " + str.Trim(arr)); Console.WriteLine("String (Hashcode) = "+str.GetHashCode()); Console.WriteLine("Bool (Hashcode) = "+val.GetHashCode()); Console.WriteLine("Bool ... Read More

148 Views
The StringBuilder.EnsureCapacity() method in C# is used to ensure that the capacity of this instance of StringBuilder is at least the specified value.SyntaxThe syntax is as follows −public int EnsureCapacity (int capacity);Above, the parameter capacity is the minimum capacity to ensure.ExampleLet us now see an example − Live Demousing System; using System.Text; public class Demo{ public static void Main(){ StringBuilder strBuilder = new StringBuilder("jhbjhb"); Console.WriteLine("String = "+strBuilder); Console.WriteLine("StringBuilder capacity= "+strBuilder.Capacity); strBuilder.EnsureCapacity(20); Console.WriteLine("StringBuilder capacity= "+strBuilder.Capacity); char[] arr = new char[5] {'a', 'b', 'c', ... Read More

511 Views
The Int64.ToString() method in C# is used to convert the numeric value of this instance to its equivalent string representation.SyntaxThe syntax is as follows −public override string ToString (); public string ToString (string format);Above, the parameter format is a numeric format string.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(){ long val1 = 0; long val2 = Int64.MaxValue; Console.WriteLine("Value1 = "+val1.ToString()); Console.WriteLine("Value2 = "+val2.ToString()); Console.WriteLine("Are they equal? = "+val1.Equals(val2)); Console.WriteLine("Value1 (HashCode) = "+val1.GetHashCode()); ... Read More

339 Views
The Random.NextBytes() method in C# is used to fill the elements of a specified array of bytes with random numbers.SyntaxThe syntax is as follows −public virtual void NextBytes (byte[] buffer);Above the buffer is the array of bytes.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(){ Random r = new Random(); Random r2 = new Random(); Random r3 = new Random(); Byte[] arr = new Byte[5]; r3.NextBytes(arr); Console.WriteLine("Random numbers....."); for (int i = 1; i

137 Views
The Queue.GetEnumerator() method in C# is used to return an enumerator that iterates through the Queue.SyntaxThe syntax is as follows:public virtual System.Collections.IEnumerator GetEnumerator ();ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo { public static void Main(){ Queue queue = new Queue(); queue.Enqueue(100); queue.Enqueue(200); queue.Enqueue(300); queue.Enqueue(400); Console.WriteLine("Queue1..."); IEnumerator demoEnum = queue.GetEnumerator(); while (demoEnum.MoveNext()){ Console.WriteLine(demoEnum.Current); } Queue queue2 = new Queue(); ... Read More