Login-Validation in Monodevelop


Login-Validation Account with Monodevelop:

This is a Login-Validation application where the user can insert their user name and password. If the user name & password inserted correctly then a welcome message displays. 

Coding:

using System;
namespace login
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine("********** LOGIN ACOUNT **********");
            Console.WriteLine("ENTER YOUR USER NAME :");
            string user = Console.ReadLine();
            Console.WriteLine("ENTER YOUR PASSWORD :");
            string pass = Console.ReadLine();
            if (user == "DEEPAK" || user == "deepak")
            {
                if (pass == "DWIJ" || pass == "dwij")
                {
                    Console.WriteLine("*************** MCN SOLUTION WELCOME'S" + "\t" + user + "!!!!!!!!!!!!");
                    Console.WriteLine("         STRING CHOICES ");
                    Console.WriteLine("*------------------------------*");
                    Console.WriteLine("  1.String Length");
                    Console.WriteLine("  2.Treating Strings as Arrays");
                    Console.WriteLine("  3.Concatenating Strings");
                    Console.WriteLine("  4.Comparing String");
                    Console.WriteLine("  5.String Replacement");
                    Console.WriteLine("*-------------------------------*");
                    Console.WriteLine("ENTER YOUR CHOICE");
                    int a = Convert.ToInt32(Console.ReadLine());
                    switch (a)
                    {
                        case 1: Console.WriteLine("Enter the String");
                            string slen = Console.ReadLine();
                            Console.WriteLine("String length is :" + slen.Length); break;
                        case 2: Console.WriteLine("Enter the String");
                            string s = Console.ReadLine();//Displays character
                            Console.WriteLine(s[2] + "\t" + "Displaying 3rd character of string "); //s[0],s[1].....s[n]
                            break;
                        case 3: Console.WriteLine("Enter the String");
                            string s1 = Console.ReadLine();
                            Console.WriteLine("Enter another String");
                            string s2 = Console.ReadLine();
                            Console.WriteLine(s1 + "\t" + s2);
                        break;
                        case 4: Console.WriteLine("Enter the String");
                            string s3 = Console.ReadLine();
                            Console.WriteLine("Enter another String");
                            string s4 = Console.ReadLine();
                            if (s3 == s4)
                            {
                                Console.WriteLine("Strings  matched..");
                            }
                            else
                            {
                                Console.WriteLine("Strings dont matched..");
                            }
                            break;
                        case 5: Console.WriteLine("Enter the String");
                            string s5 = Console.ReadLine();
                            string news;
                            news = s5.Replace(s5, "---Love Is Blind---");
                            Console.WriteLine(news);
                            break;
                        default: Console.WriteLine("Invalid choice !"); break;
                    }
                    Console.WriteLine("***************************************");
                    Console.WriteLine("Thanks you  !! DEEPAK DWIJ !!");
                    Console.Read();
                }
            }
            else
            {
         
Console.WriteLine(" Sorry !! invalid user & password : "+"\t"+user+"\t"+pass);
            }
        }
    }
}

Output: To Run Press Ctrl+F5 then

Enter your user name

1.gif

Enter your user name and password

 2.gif

If the user name & password are correctly input then a welcome message displays. Here are the number of choices you can enter

3.gif

1.To find the String Length

4.gif

2.Treating string as an Arrays

5.gif

3.To Concatenating strings

7.gif

4.To compare the Strings

7.gif

5.To replacing a string

8.gif

Otherwise invalid user displays

9.gif


Similar Articles