Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
target=variable io if loop function vector1D vector2D file procedure_math procedure_calling procedure_loop procedure_simplest procedure
#if defined TARGET_variable
#define TARGET variable
#define TARGET_FR variables
#endif
#if defined TARGET_io
#define TARGET io
#define TARGET_FR Entres-Sorties
#endif
#if defined TARGET_if
#define TARGET if
#define TARGET_FR conditionnelles
#endif
#if defined TARGET_loop
#define TARGET loop
#define TARGET_FR boucles
#endif
#if defined TARGET_function
#define TARGET function
#define TARGET_FR fonctions
#endif
#if defined TARGET_vector2D
#define TARGET vector2D
#define TARGET_FR tableaux 2D
#endif
#if defined TARGET_file
#define TARGET file
#define TARGET_FR Fichiers et flux
#endif
#if defined TARGET_vector1D
#define TARGET vector1D
#define TARGET_FR tableaux
#endif
#if defined TARGET_procedure_math
#define TARGET procedure_math
#define TARGET_FR Procdures et oprations mathmatiques
#endif
#if defined TARGET_procedure_loop
#define TARGET procedure_loop
#define TARGET_FR Procdures et boucles
#endif
#if defined TARGET_procedure_calling
#define TARGET procedure_calling
#define TARGET_FR Procdures appelant une procdure
#endif
#if defined TARGET_procedure_simplest
#define TARGET procedure_simplest
#define TARGET_FR Procdures simples
#endif
#if defined TARGET_procedure
#define TARGET procedure
#define TARGET_FR Procdures
#endif
\title{Comprhension de programmes C++ (TARGET_FR)}
\description{Comprhension de programmes C++ (TARGET_FR)}
\language{fr}
\niveau{U1}
\author{Nicolas M. Thiry}
\email{Nicolas.Thiery@u-psud.fr}
\format{html}
\integer{static=0}
\if{\static == 0}{
% Initialization of strings that will be randomly substituted
\integer{CI1=random(1..3)}
\integer{CI2=random(1..3)}
\text{I=shuffle(i,j,k,n)}
\text{I1=item(1,\I)}
\text{I2=item(2,\I)}
\text{I3=item(3,\I)}
\text{I4=item(4,\I)}
\text{D=shuffle(x,y,z)}
\text{D1=item(1,\D)}
\text{D2=item(2,\D)}
\text{D3=item(3,\D)}
\text{F1=f}
}
\text{module_data=modules/devel/nthiery/test~coding~readingCppPrograms.fr/data/}
\text{programs=wims(lookup TARGET in data/static/index)}
\text{program=randomitem(\programs)}
\if{\static == 1}{
\text{code=wims(record 0 of data/static/\program)}
}{
\text{code=wims(record 0 of data/\program)}
\text{code=wims(replace CI1 by \CI1 in \code)}
\text{code=wims(replace CI2 by \CI2 in \code)}
\text{code=wims(replace I1 by \I1 in \code)}
\text{code=wims(replace I2 by \I2 in \code)}
\text{code=wims(replace I3 by \I3 in \code)}
\text{code=wims(replace I4 by \I4 in \code)}
}
\integer{height=wims(linecnt \code)+3}
\integer{heightpixels=10*\height}
\if{_input.cpp isin \program}{
\text{answerstyle=text}
\text{answer=wims(lines2words wims(record 0 of data/static/\program.answer))}
}{
\text{answerstyle=symtext}
\if{\static == 1}{
\text{answer=wims(lines2words wims(record 0 of data/static/\program.answer))}
}{
\text{answer=wims(lines2words wims(exec secure_exec data/tmpdir compile_and_run))}
}
}
\css{
<script type="text/javascript" src="scripts/js/edit_area/edit_area_full.js"></script>
<script type="text/javascript">
editAreaLoader.init({
id: "wims_show"
,start_highlight: true
,allow_toggle: false
,allow_resize: true
,language: "fr"
,syntax: "cpp"
,min_height: 200
,min_width: 300
,is_editable:false
,toolbar: ""
,show_line_colors: false
});
</script>
}
\statement{
\if{_input.cpp isin \program}{
<p>Quel nombre entre 0 et 99 devrait saisir l'utilisateur pour que le programme C++ suivant affiche 42?</p>
}{
<p>Quel affichage exact produit le programme C++ suivant?</p>
<p>Les espaces, tabulations et sauts de lignes dans la rponse sont considrs comme quivalents.</p>
}
<textarea id="wims_show" cols="80" rows="\height" name="wims_show" readonly="readonly">\special{tabs2lines \code}</textarea>
}
\answer{}{\answer}{type=\answerstyle}