j'ai essaye de traduire l'exercice aue j'ai du l'anglais,j'espere que vous pouvez m'aider, merciiii
l'exercice traduit de l'anglais:
"Initialiser un tableau de 8 * 8 éléments doubles: A i, j = sin (2i +3 j).
Conception d'une fonction qui imprime le contenu d'un tableau carré passe comme argument de fonction, sous une forme agréable, en préservant mise row_order y compris (entre parenthèses) les valeurs des indices.
concevoir une fonction qui retourne la somme des éléments de rang j-ème donnée et de la colonne i-ème (valeur réelle de i, j passé comme arguments de la fonction) de la matrice carrée passé en tant qu'argument troisième fonction.
Mettre en œuvre toutes les opérations (si possible) en deux variantes: l'aide d'indices et en utilisant l'arithmétique des pointeurs.
original text:
"Initialize an array 8*8 of double elements: A i,j=sin(2i+3j).
Design a function which prints the contents of a square array passes as the function argument, in a nice form, preserving row_order layout including(in brackets) the values of indices.
design a function which returns the sum of elements of given j-th row and i-th column (actual value of i,j passed as the function arguments) of the square array passed as the third function argument.
Implement all operations(if possible) in two variants: using indices and using pointer arithmetic"
voila coment j'ai commence:
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 #include <stdio.h> #include<math.h> void printarray(double a[8][8]); double sum(double a[i][j],int i,int j); int main () { double a[8][8]; for(i=0;i<8;i++) for(j=0;j<8;j++) a[i][j]=sin(2*i+3*j); } void printarray(double a[8][8]) { for(i=0;i<8;i++) for(j=0;j<8;j++) { printf("(%d),i+1); printf("(%d),j+1); printf(%.2f\t"a[i][j]); } } double sum(double a[8][8],int i,int j) {
Partager