Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
first case
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { String firstString = "act"; String secondString = "cas"; char []first_char = firstString.ToCharArray(); // Converting string to char array char []second_char = secondString.ToCharArray(); // Converting string to char array Array.Sort(first_char); // Sorting firstString characters Array.Sort(second_char); // Sorting secondString characters Console.Write("firstString value after sorting= " ); Console.WriteLine(first_char); // Checking output just for correction purpose Console.Write("SecondString value after sorting= "); Console.WriteLine(second_char); // Checking " " " " " Console.WriteLine("Answer should be false, output is " + Array.Equals(first_char,second_char)); // Wrong Output you will get if you change cas to cat means act=act will return false; /* For Rechecking purpose trying to compare two strings with String.Equals() */ String str= first_char.ToString(); // Converting char array to String String str3 = second_char.ToString(); // "" "" "" "" "" Console.WriteLine("Answer should be false, output is " + str.Equals(str3)); // Giving wrong output act=acs not True } } }
run
|
edit
|
history
|
help
0
346625
C Triangle
SingleLinkedList c# operations
testing
Array Alternate elements
array int
Expression Tree - Demo1
Rank
MIXED CONTENT - string and numbers separation in a large string
shut down