using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
public string Name { get; set; }
public int Note { get; set; }
internal class StudentNoteV2
static List<string> names = new List<string>();
static List<int> notes = new List<int>();
static List<int> mergeSortList = new List<int>();
static List<Tuple<string, int>> NotesNames = new List<Tuple<string, int>>();
static void Main(string[] args)
Console.WriteLine("Öğrenci Eklemek Mi ? Çıkış Yapmak Mı İstiyorsunuz ?");
Console.WriteLine("Eklemek / Çıkış");
input = Console.ReadLine();
if (input == "Eklemek" || input == "eklemek")
else if (input == "Çıkış" || input == "çıkış")
Console.WriteLine("Çıkış");
Console.WriteLine("Program 5 saniye sonra kapanacak...");
for (int i = 5; i > 0; i--)
Console.WriteLine($"{i} saniye kaldı...");
Console.WriteLine("Lütfen yapmak istediğiniz işlemi seçin!");
Console.WriteLine("Eklemek / Çıkış");
input = Console.ReadLine();
public static void MenuInfo()
Console.WriteLine("Ne Yapmak istiyorsunuz ?");
Console.WriteLine("1. Öğrenci Eklemek için (1 yazın)");
Console.WriteLine("2. Öğrenci Notlarının Toplamını Görmek için (2 yazın)");
Console.WriteLine("3. Öğrenci Not Sıralamasını Görmek için (3 yazın)");
Console.WriteLine("4. Öğrenci En Yüksek Ve En Düşük Notları Yazdırmak İçin (4 yazın)");
Console.WriteLine("5. Öğrencileri Listelemek İçin (5 yazın)");
Console.WriteLine("6. Öğrencilerin Notlarının Ortalaması için (6 yazın)");
Console.WriteLine("7. Eklenen Öğrencilerden Silmek (7 yazın)");
Console.WriteLine("8. Öğrenci Güncellemek (8 yazın)");
Console.WriteLine("9. Öğrencileri Alfabetik Sıralamak İçin (9 yazın)");
Console.WriteLine("10.Öğrencileri Alfabetik Sıralamak İçin (10 yazın)");
Console.WriteLine("11.Öğrenci Geçme Durumu İçin (11 Yazın) ");
Console.WriteLine("12.Öğrenci Aramak İçin (12 Yazın) ");
Console.WriteLine("13 Öğrencileri Metin Belgesine Yazdırmak İçin (13 Yazın)");
Console.WriteLine("14 Belirli Konumdaki Dosyayı Okur (14 Yazın)");
input = Console.ReadLine();
Console.WriteLine("Öğrenci Ekleyebilirsiniz Devam Edebilirsiniz...");
MergeAndSortNamesNotes();
MergeAndSortNamesNotes();
public static void AddStudent()
Student student = new Student();
Console.WriteLine("Öğrenci Girmeye Başlayabilirsiniz... (menu yazarak ana menüye gidin)");
Console.Write("İsim = ");
student.Name = Console.ReadLine();
if (student.Name != "menu") names.Add(student.Name);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Menüye Dönüyorsunuz...");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Daha hiç öğrenci girmediniz...");
Console.ForegroundColor = ConsoleColor.White;
student.Note = int.Parse(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Lütfen 9999999999 dan küçük değer giriniz");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Not 100'den küçük olmalıdır.");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Lütfen notu giriniz");
Console.ForegroundColor = ConsoleColor.White;
studentNumber = names.Count;
public static void StudentList()
for (int i = 0; i < NotesNames.Count; i++)
Console.WriteLine((i + 1) + ".Öğrencinin Ad Soyadı:" + NotesNames[i].Item1);
Console.WriteLine((i + 1) + ".Öğrencinin Notu:" + NotesNames[i].Item2);
var stackTrace = new StackTrace();
var callerMethod = stackTrace.GetFrame(1).GetMethod().Name;
if (callerMethod == "StudentPass")
if (NotesNames[i].Item2 >= 60)
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Bu Öğrenci Geçti!!!");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Bu Öğrenci Kaldı");
Console.ForegroundColor = ConsoleColor.White;
public static void AddNotesNames()
for (int i = 0; i < names.Count; i++)
NotesNames.Add(new Tuple<string, int>(names[i], notes[i]));
public static void StudentNameList()
MergeAndSortNamesNotes();
for (int i = 0; i < NotesNames.Count; i++)
Console.WriteLine((i + 1) + ".Öğrencinin Ad Soyadı:" + NotesNames[i].Item1);
public static void MergeAndSortNamesNotes()
for (int i = 0; i < names.Count; i++)
NotesNames.Add(new Tuple<string, int>(names[i], notes[i]));
.OrderBy(tuple => tuple.Item2)
public static void MergeNotes()
for (int i = 0; i < notes.Count; i++)
mergeSortList.Add(notes[i]);
for (int i = 1; i < mergeSortList.Count; i++)
if (mergeSortList[i - 1] > mergeSortList[i])
int temp = mergeSortList[i];
mergeSortList[i] = mergeSortList[i - 1];
mergeSortList[i - 1] = temp;
public static void MergeNotesWrite()
Console.WriteLine("Notların Sıralaması;");
for (int i = 0; i < mergeSortList.Count; i++)
Console.Write(mergeSortList[i] + " ");
public static void AverageCalculation()
for (int i = 0; i < notes.Count; i++)
Console.WriteLine("Öğrencilerin not Ortalaması = " + sum / notes.Count);
public static void SumNote()
for (int i = 0; i < notes.Count; i++)
Console.WriteLine("Öğrencilerin notlarının Toplamı = " + sum);
public static void MaxNote()
var maxStudent = NotesNames.OrderByDescending(tuple => tuple.Item2).First();
Console.WriteLine($"En yüksek notlu öğrenci: {maxStudent.Item1} \nNot: {maxStudent.Item2}");
public static void MinNote()
var minStudent = NotesNames.OrderBy(tuple => tuple.Item2).First();
Console.WriteLine($"En düşük notlu öğrenci: {minStudent.Item1} \nNot: {minStudent.Item2}");
public static void DeleteStudent()
Console.WriteLine("Hangi Sıradaki Öğrenciyi Silmek İstiyorsunuz ? (Sayısını yazın lüften)");
input = int.Parse(Console.ReadLine()) - 1;
var deletingStudent = NotesNames[input];
notes.Remove(deletingStudent.Item2);
names.Remove(deletingStudent.Item1);
NotesNames.RemoveAt(input);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Silinen Öğrencinin Ad Soyadı: " + deletingStudent.Item1);
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Lütfen geçerli bir sayı girin...");
Console.ForegroundColor = ConsoleColor.White;
#region Bu Hafta Yazdığım Fonksiyonlar
public static void UpdateStudent()
while (string.IsNullOrWhiteSpace(studentName))
Console.WriteLine("Hangi Öğrenciye Ait Bilgileri Değiştirmek İstiyorsunuz ?");
studentName = Console.ReadLine()?.Trim();
if (string.IsNullOrWhiteSpace(studentName))
Console.WriteLine("Lütfen geçerli bir öğrenci adı girin.");
Console.WriteLine($"Bir hata oluştu: {ex.Message}");
int studentIndex = NotesNames.FindIndex(student => student.Item1.Equals(studentName, StringComparison.OrdinalIgnoreCase));
Console.WriteLine($"Mevcut öğrenci: {NotesNames[studentIndex].Item1} \nNotu: {NotesNames[studentIndex].Item2}");
Console.WriteLine("Ne güncellemek istiyorsunuz? (1: İsim, 2: Not)");
int choice = int.Parse(Console.ReadLine());
Console.WriteLine("Yeni ismi girin:");
string newName = Console.ReadLine()?.Trim();
NotesNames[studentIndex] = Tuple.Create(newName, NotesNames[studentIndex].Item2);
names[studentIndex] = newName;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("İsim başarıyla güncellendi!");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Yeni notu girin:");
int newScore = int.Parse(Console.ReadLine());
NotesNames[studentIndex] = Tuple.Create(NotesNames[studentIndex].Item1, newScore);
notes[studentIndex] = newScore;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Not başarıyla güncellendi!");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Lütfen geçerli bir not girin (sadece sayılar).");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Geçersiz bir seçim yaptınız. Lütfen 1 veya 2 girin.");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Lütfen geçerli bir sayı girin (1: İsim, 2: Not).");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Belirtilen isimde bir öğrenci bulunamadı.");
Console.WriteLine("Lütfen Geçerli Bir Öğrenci Giriniz...");
Console.ForegroundColor = ConsoleColor.White;
public static void NotesSortABC()
Console.WriteLine("İşte Öğrencilerin Alfabetik Sıralanması...");
.OrderBy(tuple => tuple.Item1)
public static void BetweenNotesSort()
Console.WriteLine("Hangi Not Aralığında Öğrencileri Görmek istiyorsunuz? Küçükten Büyüğe İki Sayı Giriniz...");
lowNum = int.Parse(Console.ReadLine());
highNum = int.Parse(Console.ReadLine());
.Where(tuple => tuple.Item2 > lowNum && tuple.Item2 < highNum)
Console.WriteLine($"İşte {lowNum} ve {highNum} arasındaki öğrenciler:");
public static void StudentPass()
Console.WriteLine("Öğrencilerin Geçme Durumu...");
MergeAndSortNamesNotes();
public static void SearchStudent()
Console.WriteLine("Hangi Öğrencinin Notunu Öğrenmek İstersiniz ?");
input = Console.ReadLine();
if (names.Contains(input))
.Where(tuple => tuple.Item1 == input)
Console.WriteLine("Öğrenmek istediğiniz öğrencinin bilgileri aşağıda...");
Console.WriteLine("Lütfen Geçerli Bir Öğrenci İsmi Giriniz");
public static void DataSave()
string filePath = "veriler.txt";
File.WriteAllText(filePath, string.Empty);
for (int i = 0; i < names.Count; i++)
File.AppendAllText(filePath, "Öğrenci Adı : " + NotesNames[i].Item1 + Environment.NewLine);
File.AppendAllText(filePath, "Öğrenci Notu : " + NotesNames[i].Item2 + Environment.NewLine + Environment.NewLine);
Console.WriteLine("Veriler Kaydediliyor...");
public static void FileRead()
string folderPath = @"C:\users\omerf\source\repos\StudentNoteV2\bin\Debug";
Console.WriteLine($" '{folderPath}' Konumundaki Hangi Dosyayı Görmek İstiyorsunuz ?");
string fileName = Console.ReadLine();
string filePath = Path.Combine(folderPath, fileName);
filePath = Path.Combine(filePath + ".txt");
Console.WriteLine("Dosyanız Okunuyor...");
string fileContent = File.ReadAllText(filePath, Encoding.UTF8);
Console.WriteLine($"Dosya içeriği...\n\n{fileContent}");