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
|
\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{numprint}
\usepackage{multido}
\usepackage{answers} %% exo+correction
\usepackage{ifthen} %% Tests if/then/else
\usepackage{enumerate} %% listes
\usepackage{multicol} % multicolonnage
\usepackage{Fp}
\input{xstring}
%
%
\newcommand*\eaddto[2]{%
\edef\tmp{#2}%
\expandafter\addto
\expandafter#1%
\expandafter{\tmp}
}
%
%----Structure Exercice-----
\newtheorem{Exc}{Exercice}
\Newassociation{correction}{Soln}{mycor}
\Newassociation{indication}{Indi}{myind}
\renewcommand{\Solnlabel}[1]{\bf \emph{Corrigé exercice #1:}}
%\renewcommand{\Indilabel}[1]{\bf \emph{Indication exercice #1:} \par}
%
\def\exo#1{\futurelet\testchar\MaybeOptArgmyexoo}
\def\MaybeOptArgmyexoo{\ifx[\testchar \let\next\OptArgmyexoo
\else \let\next\NoOptArgmyexoo \fi \next}
\def\OptArgmyexoo[#1]{\begin{Exc}[#1]\normalfont}
\def\NoOptArgmyexoo{\begin{Exc}\normalfont}
%
\newcommand{\finexo}{\end{Exc}}
\newcommand{\flag}[1]{}
%
\expandafter\FPseed\expandafter=\pdfuniformdeviate 1000000\relax
%
% MA COMMANDE
%
\newcommand{\operationsrelatifsI}[4]{
\def\listrelatifsVIIA{}
\def\listrelatifsVIIB{}
\def\listrelatifsVIIC{}
\def\listrelatifsVIIS{}
\FPeval{\min}{clip(#3)}
\FPeval{\max}{clip(#4)}
%
%
\multido{}{#1}{%
\FPeval{\choixI}{trunc(2*random,0)}
\FPeval{\a}{trunc((\max-\min)*random+\min,0)}\whiledo{\a=0}{\FPeval{\a}{trunc((\max-\min)*random+\min,0)}}
\eaddto{\listrelatifsVIIA}{{\a}}
\FPeval{\b}{trunc((\max-\min)*random+\min,0)}\whiledo{\b=0}{\FPeval{\b}{trunc((\max-\min)*random+\min,0)}}
\ifthenelse{\b<0}{\eaddto{\listrelatifsVIIB}{{(\b)}}}{\eaddto{\listrelatifsVIIB}{{\b}}}
%
\ifthenelse{\choixI=0}{%
\eaddto{\listrelatifsVIIS}{+}%
\FPeval{\c}{clip(\a+\b)}
\eaddto{\listrelatifsVIIC}{{\c}}
}{\eaddto{\listrelatifsVIIS}{-}
\FPeval{\c}{clip(\a-\b)}
\eaddto{\listrelatifsVIIC}{{\c}}
}
}
%
%
\exo{}
Complète les calculs ci-dessous :
\begin{multicols}{#2}
\begin{enumerate}
\multido{\n=1+1}{#1}{%
\FPeval{\choixII}{trunc(3*random,0)}
\ifthenelse{\choixII=0}{%
\item $\StrChar{\listrelatifsVIIA}{\n} \StrChar{\listrelatifsVIIS}{\n} \StrChar{\listrelatifsVIIB}{\n} = \ldots \ldots \ldots$
}{%
\ifthenelse{\choixII=1}{%
\item $\StrChar{\listrelatifsVIIA}{\n} \StrChar{\listrelatifsVIIS}{\n} \ldots \ldots \ldots = \StrChar{\listrelatifsVIIC}{\n}$
}{%
\item $\ldots \ldots \ldots \StrChar{\listrelatifsVIIS}{\n} \StrChar{\listrelatifsVIIB}{\n} = \StrChar{\listrelatifsVIIC}{\n}$
}
}
}
\end{enumerate}
\end{multicols}
%
%\begin{correction}
Les calculs complétés sont :
\begin{multicols}{#2}
\begin{enumerate}
\multido{\n=1+1}{#1}{
\item $\StrChar{\listrelatifsVIIA}{\n}\StrChar{\listrelatifsVIIS}{\n}\StrChar{\listrelatifsVIIB}{\n}=\StrChar{\listrelatifsVIIC}{\n}$
}
\end{enumerate}
\end{multicols}
%\end{correction}
\finexo
}
%
%
\begin{document}
\Opensolutionfile{mycor}[ficcorex]
\operationsrelatifsI{20}{4}{-10}{10}
\textbf{Correction}
\Closesolutionfile{mycor}
\Readsolutionfile{mycor}
%
\end{document} |
Partager