-
-
Save rangalo/543617 to your computer and use it in GitHub Desktop.
class Divide { | |
public static int divide(int dividend, int divisor) throws Exception { | |
int result = 0; | |
int sign = 1; | |
if (divisor == 0) { | |
System.out.println("Divide by 0 error"); | |
throw new Exception("Divide by 0"); | |
} | |
if (divisor < 0 ) { | |
sign *= -1; | |
divisor *= -1; | |
} | |
if (dividend < 0) { | |
sign *= -1; | |
dividend *= -1; | |
} | |
while (dividend > divisor) { | |
dividend -= divisor; | |
result++; | |
} | |
return result * sign; | |
} | |
public static void main(String[] args) { | |
try { | |
int res = Divide.divide(-7,-3); | |
System.out.println(res); | |
} | |
catch(Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
<VirtualHost *:80>
DocumentRoot "D:/htdocs/mvc/public/"
ServerName mvc.local
ErrorLog "error.log"
CustomLog "access.log" common
<Directory "D:/htdocs/mvc/public/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?url=$1
<VirtualHost *:80>
DocumentRoot "D:/htdocs/mvc/public/"
ServerName mvc.local
ErrorLog "error.log"
CustomLog "access.log" common
<Directory "D:/htdocs/mvc/public/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?url=$1
helllo moi ng
Router::get('/city/add','App\Controllers\CityController@AddForm');
Router::post('/city/add','App\Controllers\CityController@add');
Router::get('/city/list','App\Controllers\CityController@city_list');
Router::post('/city/delete','App\Controllers\CityController@delete');
Router::get('/city/edit/(\d+)','App\Controllers\CityController@showFormedit');
Router::post('/city/edit','App\Controllers\CityController@edit');