Çözüldü C# Kodumun bir kısmı düzgün çalışmıyor

Bu konu çözüldü olarak işaretlenmiştir. Çözülmediğini düşünüyorsanız konuyu rapor edebilirsiniz.

mburaktekin

Hectopat
Katılım
10 Eylül 2020
Mesajlar
4.964
Makaleler
2
Çözümler
11
Daha fazla  
Cinsiyet
Erkek
Normalde 1. notu girdikten sonra 2. notu girmem lazım ama kod buna müsaade etmiyor. Aşağıya bırakıyorum. Ne yapabilirim?
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string ad, soyad, numara;
            double not, not2, proje;
            Console.WriteLine("----OGRENCI BILGI GIRISI----");
            Console.Write("Isminizi giriniz: ");
            ad = Console.ReadLine();
            Console.Write("Soyisminizi giriniz: ");
            soyad = Console.ReadLine();
            Console.Write("Numaranızı Giriniz: ");
            numara = Console.ReadLine();

            Console.WriteLine("----NOT GIRISI----");
            while (true)
            {
                Console.Write("1. notu giriniz: ");
                not = Convert.ToUInt16(Console.Read());
             if (not>100)
                {
                    Console.Write("Not 100'den büyük olamaz...");
                  }
                else
                {
                    break;
                }
            }
            while (true)
            {
                Console.Write("2. notu giriniz: ");
                not2 = Convert.ToUInt16(Console.Read());
                if (not > 100)
                {
                    Console.Write("Not 100'den büyük olamaz...");
                }
                else
                {
                    break;
                }


            }
            while (true)
            {
                Console.Write("3. notu giriniz: ");
                proje = Convert.ToUInt16(Console.Read());
                if (not > 100)
                {
                    Console.Write("Not 100'den büyük olamaz...");

                }
                else
                {
                   break;
                }


            }

            double ort;
            ort = not + not2 + proje / 3;
            Console.WriteLine("Ortalama: "+ort);
         
            if (ort<100 && ort>85)
            {
                Console.Write("Takdir belgesi :)");
            }
            if (ort>75 && ort<85)
            {
                Console.Write("Teşekkür belgesi :/");
            }
            if (ort<75)
            {
                Console.Write("Allah'ın Takdiri :D");
            }

            Console.Write("Uygulamayı kapatmak için bir tuşa basın...");
            Console.ReadKey();
        }
    }
}
 
Son düzenleyen: Moderatör:
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string ad, soyad, numara;
            double not, not2, proje;
            Console.WriteLine("----OGRENCI BILGI GIRISI----");
            Console.Write("Isminizi giriniz: ");
            ad = Console.ReadLine();
            Console.Write("Soyisminizi giriniz: ");
            soyad = Console.ReadLine();
            Console.Write("Numaranızı Giriniz: ");
            numara = Console.ReadLine();

            Console.WriteLine("----NOT GIRISI----");
            while (true)
            {
                Console.Write("1. notu giriniz: ");
                not = Convert.ToUInt16(Console.Read());
             if (not>100)
                {
                    Console.Write("Not 100'den büyük olamaz...");
                  }
                else
                {
                    break;
                     Console.Write("2. notu giriniz: ");
                not2 = Convert.ToUInt16(Console.Read());
                if (not > 100)
                {
                    Console.Write("Not 100'den büyük olamaz...");
                }
                else
                {
                    break;
                    Console.Write("3. notu giriniz: ");
                proje = Convert.ToUInt16(Console.Read());
                if (not > 100)
                {
                    Console.Write("Not 100'den büyük olamaz...");

                }
                else
                {
                   break;
                }
                }

                }
            }
           

            double ort;
            ort = not + not2 + proje / 3;
            Console.WriteLine("Ortalama: "+ort);
         
            if (ort<100 && ort>85)
            {
                Console.Write("Takdir belgesi :)");
            }
            if (ort>75 && ort<85)
            {
                Console.Write("Teşekkür belgesi :/");
            }
            if (ort<75)
            {
                Console.Write("Allah'ın Takdiri :D");
            }

            Console.Write("Uygulamayı kapatmak için bir tuşa basın...");
            Console.ReadKey();
        }
    }
}

Buyrun. Eğer ayraç hataları olursa ekleme/çıkartma yaparak düzeltebilirsiniz. Visual Studio ortamında düzenlemediğim için ayraç hatası olabilir.
 
Else'e continue verip dener misiniz?
Yok hocam sonsuz döngüye girdi böyle.
Console.Read() yazan yerlere Console.ReadLine() yazmayı dene.
Oldu. Bunların farkı nedir?
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string ad, soyad, numara;
            double not, not2, proje;
            Console.WriteLine("----OGRENCI BILGI GIRISI----");
            Console.Write("Isminizi giriniz: ");
            ad = Console.ReadLine();
            Console.Write("Soyisminizi giriniz: ");
            soyad = Console.ReadLine();
            Console.Write("Numaranızı Giriniz: ");
            numara = Console.ReadLine();

            Console.WriteLine("----NOT GIRISI----");
            while (true)
            {
                Console.Write("1. notu giriniz: ");
                not = Convert.ToUInt16(Console.Read());
             if (not>100)
                {
                    Console.Write("Not 100'den büyük olamaz...");
                  }
                else
                {
                    break;
                     Console.Write("2. notu giriniz: ");
                not2 = Convert.ToUInt16(Console.Read());
                if (not > 100)
                {
                    Console.Write("Not 100'den büyük olamaz...");
                }
                else
                {
                    break;
                    Console.Write("3. notu giriniz: ");
                proje = Convert.ToUInt16(Console.Read());
                if (not > 100)
                {
                    Console.Write("Not 100'den büyük olamaz...");

                }
                else
                {
                   break;
                }
                }

                }
            }
        

            double ort;
            ort = not + not2 + proje / 3;
            Console.WriteLine("Ortalama: "+ort);
      
            if (ort<100 && ort>85)
            {
                Console.Write("Takdir belgesi :)");
            }
            if (ort>75 && ort<85)
            {
                Console.Write("Teşekkür belgesi :/");
            }
            if (ort<75)
            {
                Console.Write("Allah'ın Takdiri :D");
            }

            Console.Write("Uygulamayı kapatmak için bir tuşa basın...");
            Console.ReadKey();
        }
    }
}

Buyrun. Eğer ayraç hataları olursa ekleme/çıkartma yaparak düzeltebilirsiniz. Visual Studio ortamında düzenlemediğim için ayraç hatası olabilir.
Hocam bu kodda 2 tane hata verdi. Düzeltmeyi şimdi gördüm. Teşekkür ederim. Ama hata ayraç hatası değil. Sanırım değişkenlerle ilgili.
 

Geri
Yukarı