update
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void){
|
||||
FILE *fic = fopen("reitne.txt", "r");
|
||||
char lettre[256];
|
||||
int i;
|
||||
|
||||
if(fic == NULL){
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while(fgets(lettre, 255, fic) != NULL){
|
||||
for(i=0;i<256;i++){
|
||||
|
||||
if (lettre[i] == 'x' && lettre[i-1] == 0){
|
||||
/* printf("%d\n", lettre[i-1]/lettre[i+1]);*/
|
||||
printf("Bonjour");
|
||||
|
||||
}else if(fgets(lettre,255,fic)){
|
||||
printf("");
|
||||
|
||||
}
|
||||
}
|
||||
printf("%s", lettre);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
fclose(fic);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
8
DEV.1.1/CM2/Makefile
Normal file
8
DEV.1.1/CM2/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
moyenne : ex2.o moyenne_val.o
|
||||
gcc -ansi -pedantic moyenne ex2.o moyenne_val.o
|
||||
|
||||
moyenne_val.o : moyenne_val.c moyenne_val.h
|
||||
gcc -ansi -pedantic moyenne_val.c
|
||||
|
||||
ex2.o : ex2.c moyenne_val.h
|
||||
gcc -ansi -pedantic ex2.c
|
15
DEV.1.1/CM2/ex1.c
Normal file
15
DEV.1.1/CM2/ex1.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
struct stat buffer;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++){
|
||||
printf("%d\n",argc);
|
||||
}
|
||||
|
||||
taille = strtol(argv)
|
||||
printf("%jd octets\n",buffer.st_size);
|
||||
}
|
19
DEV.1.1/CM2/ex2.c
Normal file
19
DEV.1.1/CM2/ex2.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "moyenne_val.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int i, j, taille, tab[];
|
||||
for (i = 0; i <= argc; i++){
|
||||
taille = i;
|
||||
|
||||
}
|
||||
|
||||
for(i=0; i <= taille; i++){
|
||||
tabl_val[][i] =
|
||||
/*La fonction avait initialement pour but de mettre chaque élément dans un tableau*/
|
||||
}
|
||||
moyenne_val(taille, argv);
|
||||
}
|
18
DEV.1.1/CM2/moyenne_val.c
Normal file
18
DEV.1.1/CM2/moyenne_val.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include "moyenne_val.h"
|
||||
|
||||
int moyenne_tab(int tab[], int taille){
|
||||
int i, moyenne_sum, somme = 0;
|
||||
|
||||
for(i=0; i<=taille; i++){
|
||||
somme += tab[i];
|
||||
}
|
||||
moyenne_sum = somme/taille;
|
||||
printf("Moyenne : %d", moyenne_sum);
|
||||
}
|
||||
|
||||
int moyenne_val(int taille ){
|
||||
int i, tabl_val[] ;
|
||||
|
||||
moyenne_tab(tabl_val, taille);
|
||||
}
|
7
DEV.1.1/CM2/moyenne_val.h
Normal file
7
DEV.1.1/CM2/moyenne_val.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef MOYENNE_VAL
|
||||
#define MOYENNE_VAL
|
||||
|
||||
int moyenne_tab(int tab[], int taille);
|
||||
int moyenne_val(int taille);
|
||||
|
||||
#endif /*MOYENNE_VAL*/
|
BIN
DEV.1.1/CM2/srivasta_CM2.tar.gz
Normal file
BIN
DEV.1.1/CM2/srivasta_CM2.tar.gz
Normal file
Binary file not shown.
30
DEV.1.1/CM2TEST/CM2A/4.Sensation-Fichiers.c
Normal file
30
DEV.1.1/CM2TEST/CM2A/4.Sensation-Fichiers.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
FILE *flux = fopen("reitne", "rb"); /* Open the file in binary mode */
|
||||
unsigned char bytes[4];
|
||||
unsigned int num;
|
||||
|
||||
if (flux == NULL) {
|
||||
perror("Error opening file");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (fread(bytes, 1, 4, flux) != 4) {
|
||||
perror("Error reading file");
|
||||
fclose(flux);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Combine the bytes into an integer (big-endian to little-endian)*/
|
||||
num = (unsigned int)bytes[0] * 256 * 256 * 256 +
|
||||
(unsigned int)bytes[1] * 256 * 256 +
|
||||
(unsigned int)bytes[2] * 256 +
|
||||
(unsigned int)bytes[3];
|
||||
|
||||
printf("%u\n", num);
|
||||
|
||||
fclose(flux);
|
||||
return 0;
|
||||
}
|
20
DEV.1.1/CM2TEST/CM2B/1.Décomposition.c
Normal file
20
DEV.1.1/CM2TEST/CM2B/1.Décomposition.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 2) {
|
||||
printf("Usage: %s <valeur réelle>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
double valeur = atof(argv[1]); // Convertit l'argument en double
|
||||
double partie_entiere, partie_decimale;
|
||||
|
||||
partie_decimale = modf(valeur, &partie_entiere);
|
||||
|
||||
printf("partie entière : %f\n", partie_entiere);
|
||||
printf("partie décimale : %f\n", partie_decimale);
|
||||
|
||||
return 0;
|
||||
}
|
15
DEV.1.1/Fichiers/.vscode/c_cpp_properties.json
vendored
Normal file
15
DEV.1.1/Fichiers/.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [],
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
16
DEV.1.1/divers/doubleur.c
Normal file
16
DEV.1.1/divers/doubleur.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int somme(int n, int m) {
|
||||
return n+m;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int valeur;
|
||||
int* p = NULL;
|
||||
printf("Entrez un entier : ");
|
||||
scanf("%d", p);
|
||||
|
||||
printf("Le double vaut %d\n", somme(*p, *p));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user