Ekmelettin: daha gelismis programi yazdirdigim baslik
https://teknoseyir.com/durum/1625637
ChatGPT, yamansin delikanli!
ChatGPT ile programlama nasil olur diye deneme yaptim.
Zamaninda C# dersinin ilk projesi aklima geldi.
Kasa programi, Console Application.
- Fiyat soruyor
- Musterinin verdigi parayi soruyor
- Geri verilecek parayi hesapliyor
- Geri verilecek parayi 1000, 500, 200, 100, 50, 20, 10, 5, 2... para birimlerine ayiriyor.
Programa asagidaki verileri girerek aldigim sonuc gayet basarili.
Ustune birkac daha soru ile gayet dersi gecebilecek seviyede bir proje ortaya cikarabiliyor 🙂
örnek olarak, lprorami gelistirmek icin, ogin fonksiyonu eklemesi istedim basit sekilde.
@achfighter yaziya code etikete ekleyecegim derken yanlislikla sildim, ortaligi niye karistiyorsun 🙂
//Kodlar
using System;
namespace PaymentCalculator
{
class Program
{
static void Main(string[] args)
{
// Welcome screen with dinosaur ASCII art
Console.WriteLine(@"
_____ _____ __
/ ___/___ ______ ____/ /__ _________ _/ /_____ _______ __
\__ \/ _ \/ ___/ | / /_ / _ \/ ___/ __ `/ __/ __ \/ ___/ |/_/
___/ / __/ / | |/ / / / __/ / / /_/ / /_/ /_/ / / | |
/____/\___/_/ |___/ /_/ \___/_/ \__,_/\__/\____/_/ |_|
");
// Ask for the username and password
Console.Write("Enter username: ");
string username = Console.ReadLine();
Console.Write("Enter password: ");
string password = Console.ReadLine();
Console.WriteLine();
// Authenticate the user
if (username != "admin" || password != "12345")
{
Console.WriteLine("Invalid credentials. Access denied.");
Console.Write("Press any key to exit...");
Console.ReadKey();
return;
}
// Greet the user by name
Console.WriteLine("Welcome, {0}!\n", username);
// Ask for the price
Console.Write("Enter the price: ");
decimal price;
while (!decimal.TryParse(Console.ReadLine(), out price))
{
Console.Write("Invalid input. Please enter a valid price: ");
}
// Ask for the amount paid
Console.Write("Enter the amount paid: ");
decimal amountPaid;
while (!decimal.TryParse(Console.ReadLine(), out amountPaid))
{
Console.Write("Invalid input. Please enter a valid amount paid: ");
}
// Calculate the payment back to the customer
decimal paymentBack = amountPaid - price;
// Display the payment back
Console.WriteLine("\nPayment back: {0:C}\n", paymentBack);
// Calculate and display the change in different money types
int[] moneyTypes = new int[] { 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1 };
foreach (int moneyType in moneyTypes)
{
int count = (int)(paymentBack / moneyType);
if (count > 0)
{
Console.WriteLine("{0} x {1:C}", count, moneyType);
paymentBack -= count * moneyType;
}
}
// Calculate and display the change in cents
int cents = (int)Math.Round(paymentBack * 100);
if (cents > 0)
{
Console.WriteLine("{0} x {1:C}", cents, 0.01m);
}
// Wait for user input before closing the console window
Console.Write("\nPress any key to exit...");
Console.ReadKey();
}
}
}





201 tl'lik ürün alıp 400 tl verdiğinde "1 lira bozuğun var mı?" diye soruyor mu yoksa 199 tl para üstü vermeye mi çalışıyor?
199tl veriyor ama chatgpt´ye bunun da talimatini verirsen, onu da yapar.
Oyun yapıyorlardı onun grafik arayüzünu nasıl yapıyor ki ?
onu bilemem ama windows form icinde alt yapiyi gayet yeterli veriyor