Answer to Question #280072 in C# for KYLE

Question #280072

Write a program in c# sharp which will ask the user to create new username and password. Once finished creating, ask the user to log in using their log in details. the system will not terminate until such time the user enters both the username and password correctly


1
Expert's answer
2021-12-15T16:23:16-0500
using System;
using System.Collections.Generic;


namespace App
{
   
    class Program
    {
        public static void Main()
        {
            Console.Write("Enter new username: ");
            string newUsername  = Console.ReadLine();
            Console.Write("Enter new password: ");
            string newPassword = Console.ReadLine();


            bool isCorrect = false;


            while (!isCorrect) {
                Console.Write("Enter the username: ");
                string username = Console.ReadLine();
                Console.Write("Enter the password: ");
                string password = Console.ReadLine();


                if (username == newUsername && password == newPassword)
                {
                    Console.WriteLine("Correct.");
                    isCorrect = true;
                }
            }


            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS