Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ParabolaFinder
- {
- class Calculator
- {
- static void Main(string[] args)
- {
- bool close = false;
- bool ask = false;
- string answer;
- double x, y;
- double g;
- while (!close)
- {
- Console.WriteLine("Eingabe X-Koordinate: ");
- x = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Eingabe Y-Koordinate: ");
- y = Convert.ToDouble(Console.ReadLine());
- g = 0.9 * (x * x) + 1.3 * x - 0.7;
- g = Math.Round(g, 1);
- Console.WriteLine($"g = {g}");
- if (g == y)
- {
- Console.WriteLine("Punkt ist auf Parabel!");
- }
- else
- {
- Console.WriteLine("Punkt ist nicht auf Parabel!");
- }
- do
- {
- Console.WriteLine("Neu starten? (Y/N)");
- answer = Console.ReadLine();
- if ((answer.Equals("N", StringComparison.OrdinalIgnoreCase)))
- {
- close = true;
- ask = true;
- }
- if ((answer.Equals("Y", StringComparison.OrdinalIgnoreCase)))
- {
- ask = true;
- }
- if (!(answer.Equals("Y", StringComparison.OrdinalIgnoreCase)) && !(answer.Equals("N", StringComparison.OrdinalIgnoreCase)))
- {
- Console.WriteLine("Ungültige Eingabe");
- }
- } while (!ask);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement