Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
projet
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#!/bin/bash affichage() { for i in `seq 0 $[$n-1]`; do for j in `seq 0 $[$m-1]`; do printf "%s" "${tableau[$((i*m+j))]}" done echo "" done if [ $m -lt 10 ] then printf "0" fi echo "$m" if [ $n -lt 10 ] then printf "0" fi echo "$n" } read -p 'hauteur : ' n read -p 'longueur : ' m let "taille = n*m" echo $taille reponse='n' while [ $reponse != 'o' ]; do tableau=('â– ') for i in `seq 0 $[$taille-1]`; do nombre=$[($RANDOM % (100))] if [ $nombre -le $1 ] then tableau[i]='.' else tableau[i]='#' fi done nombre_minot=$[($RANDOM % ($[$taille]))] tableau[$nombre_minot]='M' nombre_dedal=$nombre_minot while [ $nombre_dedal = $nombre_minot ]; do nombre_dedal=$[($RANDOM % ($[$taille]))] done tableau[$nombre_dedal]='D' nombre_these=$nombre_minot while [ $nombre_these = $nombre_minot ] || [ $nombre_these = $nombre_dedal ]; do nombre_these=$[($RANDOM % ($[$taille]))] done tableau[$nombre_these]='T' affichage read -p 'c est correct? ' reponse done affichage affichage > instance.lb
[
+
]
Show input
edit mode
|
history
|
discussion