Salut salut

J'ai un exercices pour un cours mais je comprend pas l'énnoncer !

si quel'qun pouvais m'éclairer ... l'énoncé c'est adapté l'exercices 6.15 precedement fait (que j'ai mis ci dessous) pour que les quatre calculs soient réaliser dans des fonctions renvoyant le résultat du "calcul"

dois je faire une fonction ln, cos , sin et puis les appeler via le menu ?? si oui comment faire ??

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Program Fonction8b;
 
{scéance 8.b - fonction math - procedure}
 
{réalisation Sebastien Degreve - http://online.freezee.org}
 
uses math,crt;
 
{------------- DECLARATION -----------------}
 
var i,n : integer;
    x,s,t : real;
    choix : char;
 
{------------- PROCEDURE--------------------}
 
 
procedure exp(var n:integer ; var x,s:real ) ;
 var t:real;
     i:integer;
     begin
     t:=1;
     s:=t;
     For i:=1 to n do begin
       t := t * x / i;
       s:=s+t;
     end;
     writeln('exp(x) =',s:3:2);
     writeln('exp(x) theor =',exp(x):3:2);
     end;
 
procedure ln(var n:integer ; var x,s:real );
 var t:real;
     i:integer;
  begin
 if (x>0) and (x<1) then begin
   t:=x; //n=2 -x²/2     n=3 x³/3
   s:=t;
 For i:=2 to n do begin
   t := -1 * t * x * (i-1) / i;
   s:=s+t;
 end;
 writeln('ln(x) =',s:3:2);
 writeln('ln(x) theor =',ln(x+1):3:2);
 end
 else writeln('Ln(x+1) ne fonctionne que avec un x dans [0,1[ !');
 end;
 
procedure cos(x:real;n:integer;s:longint);
 var t:longint;
     i:integer;
begin
t:=1;
s:=t;
For i:=1 to n do begin
  t := -1 *t * x * x / (2*i*((2*i)-1));
  s:=s+t;
  end;
writeln('cos(x) =',s:3:2);
writeln('cos(x) theor =',cos(x):3:2);
END;
 
procedure sin(x:real;n:integer;s:longint);
 var t:longint;
     i:integer;
 begin
  t:=x;
  s:=t;
For i:=1 to n do begin
  t := -1 * t * x * x / (2*i*(2*i+1));
  s:=s+t;
end;
writeln('sin(x) =',s:3:2);
writeln('sin(x) theor =',sin(x):3:2);
end;
 
{---------------PROGRAMME-------------------}
 
begin
  x:=0;
  n:=0;
  choix := 'i';
  while (choix <> 'Q') do begin
 
{--------------------MENU-------------------}
 
    Repeat
    readln;
    clrscr;
    writeln('Evaluation ');
    writeln('+++++++++++');
    writeln('E   exp(x) ');
    writeln('L   ln(x+1)');
    writeln('C   cos(x) ');
    writeln('S   sin(x) ');
    writeln('-----------');
    writeln('X   changer X                 (',x:3:2,')');
    writeln('N   changer nbre d''iteration  (',n,')');
    writeln('-----------');
    writeln('Q   Quitter');
    writeln();
    writeln('Votre choix ? ... ');
    readln(choix);
    Until upcase(choix) in ['E','L','C','S','X','N','Q'];
 
{----------------- FIN MENU -------------------}
 
    case upcase(choix) of
     'E' : exp(n,x,s);
     'L' : ln(n,x,s);
     'C' : cos(n,x,s);
     'S' : sin(n,x,s);
 
     'X' : begin
         writeln('Entrez une nouvelle valeur pour X entier');
         readln(x);
           end;
     'N' : begin
         writeln('Entrez une nouvelle valeur pour n entier');
         readln(n);
           end;
 
{------------------QUITTER-------------------}
 
     'Q' : begin
         repeat
         writeln('Voulez vous vraiment quitter ? [O/N]');
         readln(choix);
         until upcase(choix) in ['O','N'];
            if (upcase(choix)='N') then choix:='i'
            else begin
             writeln;
             writeln('---------------------------------------');
             writeln;
             writeln('Au revoir');
             writeln;
             writeln('Programme réalisé par Degreve Sébastien');
             writeln;
             writeln('Ephec 2007 - 2008');
             writeln;
             writeln('----------------------------------------');
             choix := 'Q';
             readln();
             end;
 
          end;
 
      end;
 
   end;
 
end.