diff --git a/oef/main.oef b/oef/main.oef index ce124e46eb90a16206bddae2e8580eacdad97374..4eec177a57256b1570da196e67e4da693ba96fb6 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}