From 4dfa614142efb9d1138a78e6242fbbfc4fdd30ea Mon Sep 17 00:00:00 2001 From: valarche Date: Tue, 12 Oct 2021 19:56:39 +0200 Subject: [PATCH] sem op iteratio --- Exemples/equivBoucle.c | 21 +++++++++++++++++++++ Exemples/semFor.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 Exemples/equivBoucle.c create mode 100644 Exemples/semFor.c diff --git a/Exemples/equivBoucle.c b/Exemples/equivBoucle.c new file mode 100644 index 0000000..9ed1327 --- /dev/null +++ b/Exemples/equivBoucle.c @@ -0,0 +1,21 @@ +#include +#include + +int main (void) { + int i = 0; + int j = 0; + + while (C()) { + f(); + } + + if (C()) { + do { + f(); + } while (C()); + } + + for( ; C(); ) { + f(); + } +} \ No newline at end of file diff --git a/Exemples/semFor.c b/Exemples/semFor.c new file mode 100644 index 0000000..1641f5f --- /dev/null +++ b/Exemples/semFor.c @@ -0,0 +1,34 @@ +#include +#include + +int main (void) { + int i = 0; + + for (i = V1; conditionSur(i); i = f(i) ) { + calcul(); + } + /* Pareil que */ + i = V1; + for( ; conditionSur(i) ; i = f(i)) { + Calcul(); + } + /* Pareil que */ + for (i = V1; conditionSur(i); ) { + Calcul(); + i = f(i); + } + /* Pareil que */ + for (i = V1; ; i = f(i)) { + if (ConditionSur(i)) { + Calcul(); + } else { + break; + } + } + /* Pareil que */ + i = V1; + while (ConditionSur(i)) { + Calcul(); + i = f(i); + } +} \ No newline at end of file