debut TP16
This commit is contained in:
BIN
DEV1.1/TP15/miroir
Executable file
BIN
DEV1.1/TP15/miroir
Executable file
Binary file not shown.
@@ -4,19 +4,23 @@
|
||||
|
||||
int remplissage( int tab[10]){
|
||||
int tour,signe;
|
||||
int tab_temp[2];
|
||||
srand(time(NULL));
|
||||
for (tour=0;tour<10;tour++){
|
||||
tab[tour]=rand()%51;
|
||||
int tab_temp[2]={tab[tour],tab[tour]*(-1)};
|
||||
tab_temp[0]=tab[tour];
|
||||
tab_temp[1]=tab[tour]*(-1);
|
||||
signe=rand()%2;
|
||||
tab[tour]=tab_temp[signe];
|
||||
}
|
||||
return *tab;
|
||||
}
|
||||
|
||||
int inversion(const int tab[10], int tab_inv[10]){
|
||||
int tour;
|
||||
for (tour=0;tour<10;tour++)
|
||||
tab_val[tour]=tab[(9-tour)];
|
||||
tab_inv[tour]=tab[(9-tour)];
|
||||
return *tab_inv;
|
||||
}
|
||||
|
||||
void affichage( int tab[10]){
|
||||
@@ -33,11 +37,12 @@ void affichage( int tab[10]){
|
||||
for (tour=0;tour<10;tour++)
|
||||
printf("-----+");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int tab[10];
|
||||
remplissage(tab);
|
||||
int tab_inv[10];
|
||||
remplissage(tab);
|
||||
inversion(tab,tab_inv);
|
||||
affichage(tab);
|
||||
printf("\n");
|
||||
|
||||
BIN
DEV1.1/TP15/zero
Executable file
BIN
DEV1.1/TP15/zero
Executable file
Binary file not shown.
18
DEV1.1/TP15/zero.c
Normal file
18
DEV1.1/TP15/zero.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int zero(double a) {
|
||||
a = 0.0;
|
||||
return a;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
double x=37.5;
|
||||
printf("avant : %f\n", x);
|
||||
x=zero(x);
|
||||
printf("après : %f\n", x);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*Elle ne fait pas son travaille car la fonction ne renvoie
|
||||
rien et que la valeur 0 n'est pas atribuées*/
|
||||
Reference in New Issue
Block a user