Debut TP14
This commit is contained in:
Binary file not shown.
@@ -2,8 +2,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
long long int x = 4614256656552045848LL,n=x/2;
|
||||
double* p = (double*) &n;
|
||||
printf("π = %f\n", *p);
|
||||
return EXIT_SUCCESS;
|
||||
long long int n = (4614256656552045848LL);
|
||||
double* p = (double*) &n;
|
||||
*p = *p*2;
|
||||
printf("π = %f\n", *p);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/TP14/initiale
Executable file
BIN
DEV1.1/TP14/initiale
Executable file
Binary file not shown.
17
DEV1.1/TP14/initiale.c
Normal file
17
DEV1.1/TP14/initiale.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int main(int argc,char** argv) {
|
||||
char mot[20];
|
||||
if (argc > 1){
|
||||
mot[20]=*argv[1];
|
||||
mot[20]='\0';
|
||||
printf("%c\n",(mot[1]));
|
||||
}
|
||||
else
|
||||
puts("aucun argument !");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/TP14/lecture
Executable file
BIN
DEV1.1/TP14/lecture
Executable file
Binary file not shown.
19
DEV1.1/TP14/lecture.c
Normal file
19
DEV1.1/TP14/lecture.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int main(void) {
|
||||
int nbr_char;
|
||||
char mdp[26];
|
||||
printf("Mot de passe : ");
|
||||
mdp[0]=getchar();
|
||||
for(nbr_char=1;mdp[nbr_char-1]!='\n';nbr_char++)
|
||||
mdp[nbr_char]=getchar();
|
||||
mdp[nbr_char-1]='\0';
|
||||
if (strlen(mdp)<=27)
|
||||
printf("Mot de passe validé\n");
|
||||
else
|
||||
printf("Mot de passe non validé\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/TP14/statistique
Executable file
BIN
DEV1.1/TP14/statistique
Executable file
Binary file not shown.
21
DEV1.1/TP14/statistique.c
Normal file
21
DEV1.1/TP14/statistique.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int main(void) {
|
||||
int nbr_char_e=0;
|
||||
unsigned int nbr_char;
|
||||
char texte[201];
|
||||
printf("Texte : ");
|
||||
fgets(texte,200,stdin);
|
||||
for(nbr_char=0;texte[nbr_char]!='\n';nbr_char++){
|
||||
if (texte[nbr_char]=='e')
|
||||
nbr_char_e++;
|
||||
}
|
||||
texte[201]='\0';
|
||||
nbr_char=strlen(texte);
|
||||
printf("nombre de e = %d\n",nbr_char_e);
|
||||
printf("nombre de lettre = %d\n",nbr_char);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user