Skip to content
Snippets Groups Projects
Commit 4c99f651 authored by Nicolas M. Thiéry's avatar Nicolas M. Thiéry
Browse files

WIMS: debug reorganisation

parent 44b2c81e
No related branches found
No related tags found
No related merge requests found
Showing
with 159 additions and 77 deletions
......@@ -8,7 +8,6 @@
\text{code_celibataire=randitem(célibataire, marié(e))}
<!-- Il faut que le source soit logique en fonction de la question 2 (célibataire ou marié(e)) -->
\text{code_etat1=\code_celibataire issametext célibataire ? Mademoiselle : Madame}
\text{code_etat2=\code_celibataire issametext célibataire ? Madame : Mademoiselle}
......
# This file is automatically generated by Modtool 4.05.
# Do not edit by hand.
title=Exercices de programmation C++
description=quelques exercices de lecture et interprtation de programmes en C++.
language=fr
category=oef, exercise
domain=programming,
level=U1
keywords=C++
require=
scoring=yes
copyright=&copy; 2014 (<a href=\COPYING\>GNU GPL</a>)
author=Nicolas,Thiery
address=Nicolas.Thiery@u-psud.fr
version=1.00
wims_version=
vardef=oef/var.def
translator=
translator_address=
data=
maintainer=
maintainer_address=
translation_language=
PROGRAMS=$(wildcard data/*.cpp)
OUTPUT=$(PROGRAMS:%=%.output)
TARGETS=variables if loop function
all: data/index $(OUTPUT)
data/index: $(PROGRAMS)
cd data; \
(echo "all: "`ls -m $$target_*.cpp`) > index; \
for target in $(TARGETS); do \
(echo "$$target: "`ls -m $${target}_*.cpp`) >> index; \
done
data/%.output: data/%.bin
./$< > $@
data/%.cpp.bin: data/%.cpp
g++ $< -o $@
clean:
rm data/*.bin data/*.output data/index
#main.oef: header.oef programs/guess-output/*.cpp footer.oef Makefile
# cd programs/guess-output; make all.oef
# cat header.oef programs/guess-output/all.oef footer.oef > main.oef
# This file registers changes to the module.
# Please write in reverse order: the last version first.
Version 1.00:
First publication.
Pour installer des exercices OEF dans un module :
1. Créer un module de type OEF
2. Pour chaque exercice, créer dans le module un nouveau fichier
d'extension oef dans le répertoire src/ (exemple : src/euclide.oef).
Une zone de texte apparaît ; y écrire (ou coller) le texte source
de l'exercice. Enregistrer les changements.
3. Tester le module.
4. Modifier à son goût intro.phtml et endhook.phtml,
et tester à nouveau.
%%%%%% Pour utiliser directement le module sur un serveur WIMS local,
1- Mettre le template à la bonne place,
en changeant le nom.
2. Modifier intro.phtml
3. Modifier le fichier INDEX.
4. Installer les fichiers sources.
5. Exécuter le script $wims_home/other/bin/src2def. (Cette étape
doit être répétée à chaque fois que les fichiers sources sont modifiés).
!changeto oef/about.phtml
#include <iostream>
using namespace std;
int max(int x, int y) {
if(x > y) {
return x;
}
return y;
}
int blackJack(int x, int y) {
if(x > 21) {
if(y > 21) {
return 0;
}
return y;
}
if (y > 21) {
return x;
}
return max(x,y);
}
int main() {
int x,y;
x = 15;
y = 22;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
x = 12;
y = 17;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
x = 23;
y = 25;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
}
using namespace std;
int max(int x, int y) {
if (x > y) {
return x;
}
return y;
}
int blackJack(int x, int y) {
if (x > 21) {
if (y > 21) {
return 0;
}
return y;
}
if (y > 21) {
return x;
}
return max(x,y);
}
int main() {
int x,y;
x = 15;
y = 22;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
x = 12;
y = 17;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
x = 23;
y = 25;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
}
#include <iostream>
using namespace std;
int main() {
int i = 1;
while(i < 11) {
cout << i << endl;
i = i * 2;
}
}
using namespace std;
int main() {
int i = 1;
while(i < 11) {
cout << i << endl;
i = i * 2;
}
}
#include <iostream>
using namespace std;
int main() {
int i = 0;
while(i < 11) {
cout << i << endl;
i = i + 2;
}
}
using namespace std;
int main() {
int i = 0;
while(i < 11) {
cout << i << endl;
i = i + 2;
}
}
#include <iostream>
using namespace std;
int main() {
int i = 6;
while(i!=1) {
cout << i << endl;
if(i%2==1) {
i = 3*i + 1;
} else {
i = i/2;
}
}
}
using namespace std;
int main() {
int i = 6;
while ( i != 1 ) {
cout << i << endl;
if ( i%2 == 1 ) {
i = 3*i + 1;
} else {
i = i/2;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment