From 5a186cd6e3dd4b870aa9890504ace8aa88893eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20M=2E=20Thi=C3=A9ry?= <nthiery@users.sf.net> Date: Mon, 29 Sep 2014 00:15:53 +0200 Subject: [PATCH] WIMS: oef with two programs --- oef/main.oef | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/oef/main.oef b/oef/main.oef index ce124e4..4eec177 100644 --- a/oef/main.oef +++ b/oef/main.oef @@ -4,27 +4,49 @@ \email{Nicolas.Thiery@u-psud.fr} \format{html} -\text{code= +\text{programName=random(if-semicolon.cpp, function-max.cpp)} + +\text{code= \programName issametext if-semicolon.cpp ? #include <iostream> using namespace std; int main() { int x = 1+2; if ( x == 3 ); { - cout << "Bonjour!" << endl; + cout << "Bonjour!" << endl; } cout << "Au revoir." << endl; return 0; } } +\text{code= \programName issametext function-max.cpp ? +#include <iostream> +using namespace std; + +float max(float a, float b) { + if ( a >= b ) { + return a; + } else { + return b; + } +} + +int main() { + cout << max(1.0, 3.0) << endl; + cout << max(5.0, 2.0) << endl; + cout << max(2.0, 2.0) << endl; + return 0; +} +} + \text{output= 42 } \statement{ <p> -Qu'affiche le programme suivant? +On considère le programme C++ suivant: <hr> <pre> \special{expandlines \code} @@ -32,4 +54,4 @@ Qu'affiche le programme suivant? <hr> } -\answer{La longueur}{\output}{type=text} +\answer{Qu'affiche-t'il?}{\output}{type=text} -- GitLab