This is lab 1 for Software Development Methodologies and Technologies
This tiny CLI program written in Swift lets you solve quadratic equations
-
Be sure that you have installed Git to clone the repository and Swift to run script
-
Clone the repository to you local machine
git clone https://github.com/MrPaschenko/quadratic-equation-solver
- Open directory
cd quadratic-equation-solver/Quadratic\ Equation\ Solver
- Run script
swift main.swift
There are two modes supported:
- Interactive
- Noninteractive
Welcome to Quadratic Equation Solver!
Choose mode:
Interactive (1) or Noninteractive (2)
Just enter real numbers for a, b, c variables and script will solve the problem!
>1
You chose Interactive mode
ax^2 + bx + c = 0
Please, enter real numbers
> a = 2
> b = 1
> c = -3
Equation is: (2.0) x^2 + (1.0) x + (-3.0) = 0
Discriminant is 25.0
There are 2 roots
x1 = 1.0
x2 = -1.5
Enter path to file to solve the problem
>2
You chose Noninteractive mode
Please, enter path to file
> Documents/file.txt
Equation is: (1.0) x^2 + (0.0) x + (0.0) = 0
Discriminant is 0.0
There is 1 root
x = -0.0
File's content should be as follows:
1 0 0
or
1\s0\s0\n