NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

/*using System;
using System.Text;
using System.Threading.Tasks;

namespace calculator_c_sharp
{
class Program
{
static void Main(string[] args)
{
string value;
do
{
int res;
Console.Write("Enter first number:");
int num1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter second number:");
int num2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter symbol(/,+,-,*):");
string symbol = Console.ReadLine();

switch (symbol)
{
case "+":
res = num1 + num2;
Console.WriteLine("Addition:" + res);
break;
case "-":
res = num1 - num2;
Console.WriteLine("Subtraction:" + res);
break;
case "*":
res = num1 * num2;
Console.WriteLine("Multiplication:" + res);
break;
case "/":
res = num1 / num2;
Console.WriteLine("Division:" + res);
break;
default:
Console.WriteLine("Wrong input");
break;
}
Console.ReadLine();
Console.Write("Do you want to continue(y/n):");
value = Console.ReadLine();
}
while (value=="y" || value=="Y");
}
}

}*/
//==================================================
/*using System;

class Program
{
static void Greatings()
{
// Ask the user to enter their name
Console.Write("Please enter your name: ");

// Read the name from the console
string name = Console.ReadLine();

// Print out the name
Console.WriteLine("Hello, " + name + "!");
}
}*/

//=====================================================
// See https://aka.ms/new-console-template for more information
/*using System.Reflection.Metadata.Ecma335;

Console.WriteLine("Hello, World!");

System.Console.WriteLine();
System.Console.ReadLine();

Greatings( name, age);
*/

//=============================
/*
System.Console.WriteLine("Please insert your name: ");
var ner = Console.ReadLine();

System.Console.WriteLine("Please insert your age: ");
var nas = Console.ReadLine();

Greatings(ner, Convert.ToInt32(nas));


void Greatings(String name, int age) {
System.Console.WriteLine("Hello, " + name.Contains("bbi"));//Contains dotor bga string bga esehiig shalgaj tru bolon false aar hariu ugnu
System.Console.WriteLine("You are " + age+ " years old!");

*/

//-==================================================

/*
using System;
using System.IO;
using Newtonsoft.Json;
using System.Security.Cryptography;
using System.Text;

class Program
{
private static readonly string filePath = "/home/lab-209/Project 1/week2cs4b/user.json";

static void Main(string[] args)
{
Console.WriteLine("1. Register");
Console.WriteLine("2. Login");
var choice = Console.ReadLine();
switch (choice)
{
case "1":
Register();
break;
case "2":
Login();
break;
default:
Console.WriteLine("Invalid choice.");
break;
}
}
static void Register(){
Console.WriteLine("Enter your name: ");
var username = Console.ReadLine();
Console.WriteLine("Enter your password: ");
var password = Console.ReadLine();
string hashedPassword = HashPassword(password);//hashpassword ni password iig nuutsladag
User user = new User{
Username = username,
Password = hashedPassword
};
try{
string json = JsonConvert.SerializeObject(user, Formatting.Indented);
File.WriteAllText(filePath, json);
Console.WriteLine("Successfully registered...");
}
catch (IOException e){
Console.WriteLine("Error writing to file: " + e.Message);
}
}

static void Login(){
Console.WriteLine("Enter your username: ");
string inputName = Console.ReadLine();
Console.WriteLine("Enter your password: ");
string inputPwd = Console.ReadLine();
try{
if (!File.Exists(filePath)){
Console.WriteLine("User data not found.");
return;
}
string json = File.ReadAllText(filePath);
User storedUser = JsonConvert.DeserializeObject<User>(json);
if (storedUser != null && storedUser.Username == inputName && VerifyPassword(inputPwd, storedUser.Password)){
Console.WriteLine("Logging in SUCCESSFULY");
}else{
Console.WriteLine("Login failed.");
}
}
catch (IOException e){
Console.WriteLine("Error reading from file: " + e.Message);
}
}
static string HashPassword(string password){
using (var sha256 = SHA256.Create()){
byte[] bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(password));
StringBuilder sb = new StringBuilder();
foreach (byte b in bytes){
sb.Append(b.ToString("x2"));
}
return sb.ToString();
}
}
static bool VerifyPassword(string inputPassword, string storedHashedPassword)
{
string hashedInputPassword = HashPassword(inputPassword);
return hashedInputPassword == storedHashedPassword;
}

class User
{
public string Username { get; set; }
public string Password { get; set; }
}
}

*/
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.