Ajout des exo 2 et 3 du TP4

This commit is contained in:
Moncef STITI 2024-02-18 15:18:07 +01:00
parent 18e7e6cc7f
commit dc767c9f72
71 changed files with 128 additions and 296 deletions

54
.gitignore vendored
View File

@ -1,54 +0,0 @@
# ---> C
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

View File

@ -1,5 +1,5 @@
Contrôle n°1 : 17/20 Contrôle n°1 : 17/20
Contrôle n°2 : 15.25/20 Contrôle n°2 : 15.25/20 ! plusieurs programmes qui ne fonctionne pas !
Contrôle n°3 : 18.25/20 Contrôle n°3 : 18.25/20 ! plusieurs programmes qui ne fonctionne pas ! -> EXO 1 = remplacer ... == 3 par ... == '3'

0
BUT1/DEV1.1/CM2 2022/1/repetition Executable file → Normal file
View File

0
BUT1/DEV1.1/CM2_2/CM2/carre Executable file → Normal file
View File

View File

@ -1,18 +0,0 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

View File

@ -1,24 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/export/home/an23/stiti/Desktop/EntrainementDS2/SUJET1 /EXO 1",
"program": "/export/home/an23/stiti/Desktop/EntrainementDS2/SUJET1 /EXO 1/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

View File

@ -1,37 +0,0 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wconversion",
"-Wnull-dereference",
"-Wsign-conversion"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false
}

View File

@ -1,14 +0,0 @@
# BUT PRINCIPAL
repetition_ou_pas : main.o repetition.o
gcc -ansi -pedantic -o repetition_ou_pas repetition.o main.o
repetition.o : repetition.c
gcc -ansi -pedantic -c repetition.c
main.o : main.c repetition.h
gcc -ansi -pedantic -c main.c
clean :
rm -f main.o repetition.o
.PHONY : clean

View File

@ -1,25 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include "../EXO 1/repetition.h"
int main(int argc,char* argv[]){ /* Ou "char** argv" */
int i;
long* tab;
tab = (long*) malloc(argc*sizeof(long));
/* Création d'un tableau de argc - 1 élément (Autrement dit, création d'un tableau du nombre d'éléments donner en argument au programme sans compter le a.out)*/
for(i=1;i<argc;i++){
tab[i-1] = strtol(argv[i],NULL,10);
}
if(repetition(tab,argc-1)==0){
printf("les valeurs sont différentes");
}
if(repetition(tab,argc-1)==1){
printf("les valeurs sont identiques");
}
free(tab);
return EXIT_SUCCESS;
}

View File

@ -1,13 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
int repetition(long tab[], int taille){
int i;
for(i=0;i<taille-1;i++){
if(tab[i]!=tab[i+1]){
return 0; /*False*/
}
}
return 1; /*True*/
}

View File

@ -1,6 +0,0 @@
#ifndef REPETITION_H
#define REPETITION_H
int repetition(long tab[], int taille);
#endif /* REPETITION_H */

View File

@ -1,26 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
int main(void){
FILE* fichier;
char couleur;
int i,a=5;
fichier = fopen("image","r");
if(fichier==NULL){
fputs("Erreur d'ouverture du fichier",stderr);
return EXIT_FAILURE;
}else{
while(feof(fichier)!=1){
a = fread(&couleur,1,1,fichier);
if(couleur == 0){
printf("\n");
}else{
printf("\33[48;5;%hhum \33[m",couleur);
}
}
}
fclose(fichier);
return EXIT_SUCCESS;
}

View File

@ -1,23 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <math.h>
int main(void){
int i;
struct timeval tv1;
struct timeval tv2;
gettimeofday(&tv1,NULL);
for(i=0;i<1000000;i++){
sqrt(2);
}
gettimeofday(&tv2,NULL);
printf("%dμs",tv2.tv_usec-tv1.tv_usec);
return EXIT_SUCCESS;
}

View File

View File

0
BUT1/DEV1.1/Organisation_code/exo1/exo1 Executable file → Normal file
View File

0
BUT1/DEV1.1/hello_world Executable file → Normal file
View File

View File

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 465 B

View File

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 415 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More