Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Personal_Accounts_Information
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<Accounts> users = new List<Accounts>();
- //Decides were the .txt file will be saved to.
- string path = @"D:\Personal Accounts Information.txt";
- //This will out put all the information that has allready be created in the .txt file to the console so the user
- // can see all the information they have saved.
- using (StreamReader sr = new StreamReader(path))
- {
- string line = sr.ReadToEnd();
- Console.WriteLine(line);
- }
- bool willContinue = true;
- do
- {
- string accountName;
- string userName;
- string passWord;
- Console.WriteLine("Enter your Account Name or type exit to quit program. ");
- accountName = Console.ReadLine();
- if (accountName != "exit")
- {
- Console.WriteLine("Enter your User Name for the " + accountName);
- userName = Console.ReadLine();
- Console.WriteLine("Enter your Password for the " + userName, "assotied with" + accountName);
- passWord = Console.ReadLine();
- Accounts account = new Accounts(accountName, userName, passWord);
- users.Add(account);
- }
- else
- {
- willContinue = false;
- }
- } while (willContinue);
- using (StreamWriter sw = new StreamWriter(path, true))
- {
- foreach(Accounts accounts in users)
- {
- Console.WriteLine(" Account Name: " + accounts.accountName + " UserName: " + accounts.username + " Password " + accounts.passWord);
- sw.WriteLine("Account Name: " + accounts.accountName /*.ToString()*/);
- sw.WriteLine("UserName: " + accounts.username /*.ToString()*/ + "\r\n");
- sw.WriteLine("Password: " + accounts.passWord /*.ToString()*/ + "\r\n");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement