At 6/3/12 03:52 AM, mikuru15 wrote:
How do I put a password on a console application in C#?
I can't find any tutorials on it.
basically I was thinking something like :
string password = "password123";
if (Console.WriteLine() == "password123") {
Console.WriteLine("welcome");
Console.ReadLine();
}
I really don't know
any help would be really appreciated thanx.
lösenord=Password and Användarnamn=Usernamne. Youre welcome in advance and i know school students are going to Copy and Paste this to their C# App but i dont mind, everyone is welcome to Copy and Paste this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hej, Användarnamnet är qwe123 lösenordet är Ashurbanipal123");
Console.WriteLine("Skriv in Användarnamnet");
string input = Console.ReadLine();
if (input == "qwe123")
{
Console.WriteLine("Rätt användarnamn");
Console.ReadLine();
}
else
{
Console.WriteLine("Fel Användarnamn, försök igen");
}
Console.WriteLine("skriv in Lösenordet");
input = Console.ReadLine();
if (input == "Ashurbanipal123")
{
Console.WriteLine("rätt lösen");
Console.ReadLine();
}
else
{
Console.WriteLine("fel lösenord, försök igen");
Console.ReadLine();
}
}
}
}