update
This commit is contained in:
BIN
DEV.1.1/Allocation_dynamique/1.Singletons
Executable file
BIN
DEV.1.1/Allocation_dynamique/1.Singletons
Executable file
Binary file not shown.
BIN
DEV.1.1/Allocation_dynamique/2.Palindromes
Executable file
BIN
DEV.1.1/Allocation_dynamique/2.Palindromes
Executable file
Binary file not shown.
17
DEV.1.1/Fichiers/ecriture-fichier/fprintf.c
Normal file
17
DEV.1.1/Fichiers/ecriture-fichier/fprintf.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*fprintf(<fichier>, <format>, ...) : écrit du texte formaté*/
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "w");
|
||||||
|
char mot[]="Bonjour";
|
||||||
|
int age=18;
|
||||||
|
|
||||||
|
if(fic==NULL)
|
||||||
|
{exit(1);}
|
||||||
|
|
||||||
|
fprintf(fic, "J'ai %d ans %s", age, mot);
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
}
|
15
DEV.1.1/Fichiers/ecriture-fichier/fputc.c
Normal file
15
DEV.1.1/Fichiers/ecriture-fichier/fputc.c
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*fputc(<caractère>, <fichier>) : écrit un caractère*/
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "w");
|
||||||
|
|
||||||
|
if(fic==NULL)
|
||||||
|
{exit(1);}
|
||||||
|
fputc('J',fic);
|
||||||
|
fputc('O',fic);
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
}
|
16
DEV.1.1/Fichiers/ecriture-fichier/fputs.c
Normal file
16
DEV.1.1/Fichiers/ecriture-fichier/fputs.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*fputs(<chaîne de caractère>, <fichier>) : écrit une chaîne de caractère*/
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "w");
|
||||||
|
char mot[]="Bonjour";
|
||||||
|
|
||||||
|
if(fic==NULL)
|
||||||
|
{exit(1);}
|
||||||
|
|
||||||
|
fputs(mot,fic);
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
}
|
1
DEV.1.1/Fichiers/ecriture-fichier/text.txt
Normal file
1
DEV.1.1/Fichiers/ecriture-fichier/text.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
J'ai 18 ans Bonjour
|
21
DEV.1.1/Fichiers/lecture-ficher/openfile-fgetc.c
Normal file
21
DEV.1.1/Fichiers/lecture-ficher/openfile-fgetc.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "r");
|
||||||
|
int lettre = 0;
|
||||||
|
|
||||||
|
if(fic == NULL){
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
while((lettre = fgetc(fic)) != EOF){
|
||||||
|
printf("%c", lettre);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
21
DEV.1.1/Fichiers/lecture-ficher/openfile-fgets.c
Normal file
21
DEV.1.1/Fichiers/lecture-ficher/openfile-fgets.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "r");
|
||||||
|
char lettre[256];
|
||||||
|
|
||||||
|
if(fic == NULL){
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(fgets(lettre, 255, fic) != NULL){
|
||||||
|
printf("%s", lettre);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
23
DEV.1.1/Fichiers/lecture-ficher/openfile-fscanf.c
Normal file
23
DEV.1.1/Fichiers/lecture-ficher/openfile-fscanf.c
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "r");
|
||||||
|
char texte[256];
|
||||||
|
int age = 0;
|
||||||
|
int Nombre = 0;
|
||||||
|
|
||||||
|
if(fic == NULL){
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fscanf(fic, "%s %d %d", texte, &age, &Nombre);
|
||||||
|
printf("Nom : %s\n", texte);
|
||||||
|
printf("Age : %d\n", age);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
2
DEV.1.1/Fichiers/lecture-ficher/text.txt
Normal file
2
DEV.1.1/Fichiers/lecture-ficher/text.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Emmanuel 18 1000
|
||||||
|
Toto 47 365
|
24
DEV.1.1/Fichiers/positionnement-fichier/fseek.c
Normal file
24
DEV.1.1/Fichiers/positionnement-fichier/fseek.c
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*fseek(<fichier>, <déplacement>, <origine>) : déplace curseur
|
||||||
|
-> <origine> : SEEK_SET (début du fichier)
|
||||||
|
SEEK_CUR (position courante)
|
||||||
|
SEEK_END (fin du fichier)
|
||||||
|
*/
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "r");
|
||||||
|
|
||||||
|
if(fic==NULL)
|
||||||
|
{exit(1);}
|
||||||
|
|
||||||
|
printf("Position : %d\n", ftell(fic));
|
||||||
|
|
||||||
|
fseek(fic,5,SEEK_SET);
|
||||||
|
|
||||||
|
printf("Position : %d\n", ftell(fic));
|
||||||
|
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
}
|
17
DEV.1.1/Fichiers/positionnement-fichier/ftell.c
Normal file
17
DEV.1.1/Fichiers/positionnement-fichier/ftell.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*ftell(<fichier>) : retourne la position du curseur dans le fichier
|
||||||
|
*/
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "r");
|
||||||
|
int position_cur = -1;
|
||||||
|
|
||||||
|
if(fic==NULL)
|
||||||
|
{exit(1);}
|
||||||
|
|
||||||
|
printf("Position %d\n", ftell(fic));
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
}
|
24
DEV.1.1/Fichiers/positionnement-fichier/rewind.c
Normal file
24
DEV.1.1/Fichiers/positionnement-fichier/rewind.c
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*rewind(<fichier>) : réinitialise la position du curseur
|
||||||
|
*/
|
||||||
|
int main(void){
|
||||||
|
FILE *fic = fopen("text.txt", "r");
|
||||||
|
int position_cur = -1;
|
||||||
|
if(fic==NULL)
|
||||||
|
{exit(1);}
|
||||||
|
|
||||||
|
printf("Position : %d\n", ftell(fic));
|
||||||
|
|
||||||
|
fseek(fic,5,SEEK_SET);
|
||||||
|
|
||||||
|
printf("Position : %d\n", ftell(fic));
|
||||||
|
|
||||||
|
rewind(fic);
|
||||||
|
|
||||||
|
printf("Position : %d\n", ftell(fic));
|
||||||
|
|
||||||
|
fclose(fic);
|
||||||
|
|
||||||
|
}
|
1
DEV.1.1/Fichiers/positionnement-fichier/text.txt
Normal file
1
DEV.1.1/Fichiers/positionnement-fichier/text.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Foul tarnished, in search of the Elden ring
|
57
DEV.1.2/tp2/ex4.html
Normal file
57
DEV.1.2/tp2/ex4.html
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="style_ex4.css">
|
||||||
|
|
||||||
|
<meta name="description" content="tp1/ex2">
|
||||||
|
<meta name="author" content="Denis Monnerat">
|
||||||
|
|
||||||
|
<title>Exercice 2</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Emoticons</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Emoticons are textual portrayals of a writer's moods or facial
|
||||||
|
expressions in the form of icons. Originally, these icons
|
||||||
|
consisted of ASCII art.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Emoticons can generally be divided into two groups: Western (mainly
|
||||||
|
from America and Europe) or horizontal; Eastern or vertical (mainly
|
||||||
|
from east Asia).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>Western</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Western style emoticons are mostly written from left to right as
|
||||||
|
though the head is rotated counter-clockwise 90 degrees.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Smiley: <span>:-) :-></span></li>
|
||||||
|
<li>Tongue-tied: <span>:-&</span></li>
|
||||||
|
<li>Broken heart: <span><\3</span></li>
|
||||||
|
<li>Rose: <span>@}->--</span></li>
|
||||||
|
<li>Fish: <span>><(((*></span></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Eastern</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Eastern emoticons generally are not rotated sideways. They first
|
||||||
|
arose in Japan, where they are referred to as kaomoji.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Troubled: <span>(>_<)</span></li>
|
||||||
|
<li>Sad: <span>("_")</span></li>
|
||||||
|
<li>Cat: <span>(=^·^=)</span></li>
|
||||||
|
<li>Headphones: <span>((d[-_-]b))</span></li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
52
DEV.1.2/tp2/ex5.html
Normal file
52
DEV.1.2/tp2/ex5.html
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" href="style_ex5.css">
|
||||||
|
|
||||||
|
<meta name="description" content="tp1/ex4">
|
||||||
|
<meta name="author" content="Denis Monnerat">
|
||||||
|
|
||||||
|
<title>Exercice 4 </title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<caption>Orbites des planètes du Système solaire</caption>
|
||||||
|
<thead>
|
||||||
|
<tr><th>Planète</th><th>Distance moyenne (UA)</th><th>Exentricité </th><th>Inclinaison (°)</th><th>Période de révolution (an)</th><th>Photo</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Mercure</td><td>0,38709893</td><td>0,205</td><td>7</td><td>0,241</td><td><img alt="Mercure" src="https://upload.wikimedia.org/wikipedia/commons/3/30/Mercury_in_color_-_Prockter07_centered.jpg" width="100"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Venus</td><td>0,72333199</td><td>0,007</td><td>3,4</td><td>0,615</td><td><img width="100" alt="Venus" src="https://upload.wikimedia.org/wikipedia/commons/c/c7/PIA23791-Venus-RealAndEnhancedContrastViews-20200608_%28cropped%29.jpg"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Terre</td><td>1</td><td>0,017</td><td>0</td><td>1</td>
|
||||||
|
<td><img width="100" alt="Terre" src="https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg"></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td>Mars</td><td>1,52366231</td><td>0,094</td><td>1,9</td><td>1,881</td><td><img width="100" alt="Mars" src="https://upload.wikimedia.org/wikipedia/commons/0/02/OSIRIS_Mars_true_color.jpg"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Jupiter</td><td>5,20336301</td><td>0,049</td><td>1,3</td><td>11,862</td>
|
||||||
|
<td><img src="https://upload.wikimedia.org/wikipedia/commons/7/71/PIA22946-Jupiter-RedSpot-JunoSpacecraft-20190212.jpg" width="100" alt="Jupiter"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Saturne</td><td>9,6</td><td>0,057</td><td>2,5</td><td>29,452</td>
|
||||||
|
<td><img src="https://upload.wikimedia.org/wikipedia/commons/c/c7/Saturn_during_Equinox.jpg" width="100" alt="Saturne"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Uranus</td><td>2872,5</td><td>0,8</td><td>97,8</td><td>30,589</td>
|
||||||
|
<td><img src="https://upload.wikimedia.org/wikipedia/commons/e/e5/Dark_Spot_on_Uranus.jpg" width="100" alt="Uranus"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Neptune</td><td>4495,1</td><td>1,8</td><td>28,3</td><td>59,8</td>
|
||||||
|
<td><img src="https://upload.wikimedia.org/wikipedia/commons/6/63/Neptune_-_Voyager_2_%2829347980845%29_flatten_crop.jpg" width="100" alt="Neptune"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
20
DEV.1.2/tp2/style_ex4.css
Normal file
20
DEV.1.2/tp2/style_ex4.css
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
body {
|
||||||
|
font-family:sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-variant:small-caps;
|
||||||
|
text-decoration : underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
background-color:#aaaaaa;
|
||||||
|
padding : 10px;
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-family: monospace;
|
||||||
|
font-weight:bold;
|
||||||
|
color : #aa4512;
|
||||||
|
}
|
26
DEV.1.2/tp2/style_ex5.css
Normal file
26
DEV.1.2/tp2/style_ex5.css
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
table {
|
||||||
|
font-family: sans-serif;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin : auto;
|
||||||
|
width:700px;
|
||||||
|
}
|
||||||
|
table caption {
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
font-variant: small-caps;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
border-bottom: 3px solid black;
|
||||||
|
border-top: 3px solid black;
|
||||||
|
text-align: left;
|
||||||
|
font-weight: bold;
|
||||||
|
font-variant: small-caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-bottom: 1px solid lightgray;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user