Ajout des TP

This commit is contained in:
stiti
2024-02-01 13:55:03 +01:00
parent 4fe273c309
commit 113583b37a
228 changed files with 7094 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,24 @@
{
"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/DEV/DEV1.1/CM2 2022",
"program": "/export/home/an23/stiti/DEV/DEV1.1/CM2 2022/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

View File

@@ -0,0 +1,37 @@
{
"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

@@ -0,0 +1,45 @@
### VARIABLES ###
CC = gcc
CFLAGS = -ansi \
-pedantic
EXE = repetition_dans_tableaux
OFILES = main.o \
repetition.o
### BUT PAR DEFAUT ###
but : ${EXE}
### REGLES ESSENTIELLES ###
programme : repetition.o main.o
$(CC) $(CFLAGS) -o programme repetition.o main.o
repetition.o : repetition.c repetition.h
$(CC) $(CFLAGS) -c repetition.c
main.o : main.c repetition.h
$(CC) $(CFLAGS) -c main.c
${EXE} : ${OFILES}
$(CC) $(CFLAGS) -o ${EXE} ${OFILES}
### REGLES OPTIONNELLES ###
clean :
-rm -f ${OFILES}
mrproper : clean but
### BUTS FACTICES ###
.PHONY : but clean mrproper
### FIN ###

View File

@@ -0,0 +1,20 @@
#include <stdlib.h>
#include <stdio.h>
#include "repetition.h"
int main(int argc, char* argv[]){
int i;
long* tab;
tab = (long*) malloc(argc*sizeof(long));
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\n");
}else{
printf("Les valeurs sont identiques\n");
}
return EXIT_SUCCESS;
}

BIN
BUT1/DEV1.1/CM2 2022/1/repetition Executable file

Binary file not shown.

View File

@@ -0,0 +1,12 @@
#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;
}
}
return 1;
}

View File

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

8
BUT1/DEV1.1/CM2 2022/3.c Normal file
View File

@@ -0,0 +1,8 @@
#include <stdlib.h>
#include <stdio.h>
#import <math.h>
#include <sys/time.h>
int main(void){
struct
}

View File

@@ -0,0 +1,38 @@
#include<stdio.h>
#include<stdlib.h>
#include<graph.h>
#define DELTA 1000000L
void update_timer(unsigned long int start) {
int secondes = ((Microsecondes() - start) / DELTA);
int minutes = 0;
char buf[100];
while (secondes >= 60) {
minutes += 1;
secondes -= 60;
}
ChoisirEcran(3);
EffacerEcran(CouleurParComposante(54, 57, 63));
ChoisirCouleurDessin(CouleurParNom("white"));
snprintf(buf, 100, "Temps : %02d:%02d", minutes, secondes);
EcrireTexte(20, 20, buf, 1);
CopierZone(3, 0, 0, 0, 150, 30, 0, 0);
ChoisirEcran(0);
}
unsigned long int start_timer(unsigned long int start) {
start = Microsecondes() - start;
update_timer(start);
return start;
}
unsigned long int stop_timer(unsigned long int start) {
return Microsecondes() - start;
}
void wait(int sec) {
unsigned long int end = Microsecondes() + (sec * DELTA);
while (Microsecondes() <= end);
}