00:00
00:00
Newgrounds Background Image Theme

Ryor just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

C# console application password

4,693 Views | 3 Replies
New Topic

C# console application password 2012-06-03 03:52:40


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.

Response to C# console application password 2012-06-03 06:08:33


{
Console.Write("Please enter the password: ");
input = Console.ReadLine();
} while (input != password);
Console.Write("You are in the system.");
}

Thanks a bunch just what I'm looking for :)

Response to C# console application password 2016-09-27 08:30:17


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();

}
}
}
}

Response to C# console application password 2016-09-27 09:17:35


At 9/27/16 08:30 AM, famousgrandbaby69 wrote: 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.
[...]

Please don't bump old threads like this.