ennuie transcendental

This commit is contained in:
Simon SAYE BABU 2022-11-15 11:27:45 +01:00
parent 813771185b
commit bf1a1e41b9
12 changed files with 349 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
int main(void){ int main(void){
srand(time(0)); srand(time(0));
int tab[10]; int tab[10];
@ -23,4 +24,4 @@ int main(void){
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

73
DEV1.1/TP09/decoupage.c Normal file
View File

@ -0,0 +1,73 @@
#include <stdio.h>
#include <stdlib.h>
int choix(){
char x;
printf("____________\n t) triangle\n c) Carre\n q) Quitter\nVotre choix ? :");
scanf("%c",&x);
if (x=='t')
{
return 1;
}
if (x=='c')
{
return 2;
}
if (x=='q')
{
return 0;
}
}
void triangle(int hauteur){
int maxj=1;
for(int i=1;i<=hauteur;i++){
for(int j=1;j<=maxj;j++){
printf("*");
}
printf("\n");
maxj+=1;
}
}
void carre(int hauteur){
for(int i=1;i<=hauteur;i++){
if((i==1)||(i==hauteur)){
for(int j=1;j<=hauteur;j++){
printf("*");
}
}
else{
printf("*");
for(int j=1;j<hauteur-1;j++){
printf(" ");
}
printf("*");
}
printf("\n");
}
}
int main(int argc, char const *argv[]){
int y=0;
int aFaire=choix();
if (aFaire==1)
{
printf("Hauteur ?: ");
getchar();
scanf("%d",&y);
triangle(y);
}
if (aFaire==2)
{
printf("Hauteur ?: ");
getchar();
scanf("%d",&y);
carre(y);
}
if (aFaire==0)
{
printf("Aurevoir...");
}
return 0;
}

10
DEV1.1/TP09/echange.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
void echange(int* a,int* b){
int temp;
temp=*a;
*a=*b;
*b=temp;
}

37
DEV1.1/TP09/mirroir.c Normal file
View File

@ -0,0 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void afficher(int tab[]){
for(int i=0;i<10;i++){
printf("%d, ",tab[i]);
}
printf("\n");
}
void randomize(int tab[]){
srand(time(0));
for(int i=0;i<10;i++){
tab[i]=(rand()%(50+1-(-50)))-50;
}
}
void inverser(int tab[]){
int tabM[10];
for(int i=0;i<10;i++){
tabM[i] = tab[9-i];
}
for(int i=0;i<10;i++){
tab[i] = tabM[i];
}
}
int main(int argc, char const *argv[])
{
int tab[10];
randomize(tab);
afficher(tab);
inverser(tab);
afficher(tab);
return 0;
}

17
DEV1.1/TP09/palindrome.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]){
char* mot= (char*) malloc(100*sizeof(char));
printf("rentrez un/des mot.s :\n");
fgets(mot,100,stdin);
for (int i = 0; i < 100*sizeof(char); ++i)
{
printf("%c",*(mot+i));
}
return 0;
}

48
DEV1.1/TP09/sigletons.c Normal file
View File

@ -0,0 +1,48 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]){
int x;
double temp;
printf("Combien de reel souhaitez vous rentrez ? : \n");
scanf("%d",&x);
double listChiffre[x];
for(int i=0;i<x;i++){
printf("rentrez le réel num %d : \n",i+1);
getchar();
scanf("%lf",&temp);
listChiffre[i]=temp;
}
int lastI = 0;
int dejavuuu;
double dejavu[x];
for (int i = 0; i < x; ++i)
{
dejavuuu=0;
for(int j = 0; j < sizeof(dejavu)/sizeof(double); ++j)
{
if (listChiffre[i]==dejavu[j])
{
dejavuuu++;
dejavu[j]=-1;
}
}
if (dejavuuu==0)
{
dejavu[lastI]=listChiffre[i];
lastI++;
}
}
for (int i = 0; i < lastI; ++i)
{
if (dejavu[i]!=(-1))
{
printf("%lf ",dejavu[i]);
}
}
return 0;
}

63
DEV1.1/TP09/tp9.txt Normal file
View File

@ -0,0 +1,63 @@
mkdir -p
find -depth
1)
find . -type d -name "*.install" -print
2)
find . -type f -name "*.d" -print
3)
find . -type f -empty
4)
find . -type f -size -1000c
5)
find . -type f -size +30000c
6)
find . -type f -size 1k
7)
find . -type f -size 2b
8)
find . -type f -size +30b
9)
find . -type f -size -3b
10)
find . -type f -size +1b -size -4b
11)
find . -type f -cnewer ./lib/krb5/synch/atom.install
12)
find ./lib/krb5/synch/ -mtime -4
13)
find ./lib/kernel/install.d/ -mtime +3
14)
find . -mtime 3 -ctime 2
15)
find . -perm /022
16)
find . -perm -444
17)
find . -perm 644
II)
1)
find . -maxdepth 4 -type f -name "[[:digit:]]*" -exec cp '{}' lib/kernel/config/AA/BB/CC -exec cp '{}' lib/kernel/config/AA/BB/CC/XX -exec cp '{}' lib/kernel/config/AA/BB/DD -exec cp '{}' lib/kernel/config/AA/BB/DD/YY \;

16
DEV1.1/TP09/zero.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
void zero(double* a){
*a=0.0;
}
int main(void)
{
double x=37.5;
printf("avant: %f\n",x );
zero(&x);
printf("apres: %f\n",x );
return 0;
}

47
DEV1.1/TP10/binomial.c Normal file
View File

@ -0,0 +1,47 @@
/* fichier debogueur1.c : exemple a deboguer */
#include <stdio.h>
#include <stdlib.h>
/* fonction principale */
int main(void) {
int i=-1, j=0, n, k, mem[100];
/* invite */
printf("Calcul de C(n, k) :\n");
/* saisie de n */
printf("Entrez n : ");
scanf("%d", &n);
while((n>100)||(n<1)) {
printf("n doit être compris entre 1 et 100 !\n");
printf("Entrez n : ");
scanf("%d", &n);
}
/* saisie de k */
printf("Entrez k : ");
scanf("%d", &k);
while((k>n)||(k<1)) {
printf("k doit être compris entre 1 et %d !\n", n);
printf("Entrez k : ");
scanf("%d", &k);
}
/* calculs... */
while (i<n) {
if(j<1) {
*(mem+(j=i++)+1) = 1;
} else {
*(mem+j--) += *(mem+j);
}
}
/* affichage du resultat */
printf("C(%d, %d) = ???\n", n, k);
return EXIT_SUCCESS;
}
/* fin du fichier debogueur1.c */

16
DEV1.1/TP10/doubleur.c Normal file
View 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 = (int*) malloc(2*sizeof(int));
printf("Entrez un entier : ");
scanf("%d", p);
printf("Le double vaut %d\n", somme(*p, *p));
return EXIT_SUCCESS;
}

20
DEV1.1/TP10/envers.c Normal file
View File

@ -0,0 +1,20 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void envers(const char texte[]) {
unsigned position;
for(position = strlen(texte)-1; position != 4294967295; position--) {
printf("%c", texte[position]);
}
printf("\n");
}
int main(int argc, char** argv) {
if (argc < 2) {
printf("usage : %s <texte>\n", argv[0]);
return EXIT_FAILURE;
}
envers(argv[1]);
return EXIT_SUCCESS;
}

0
DEV1.1/TP10/tutoriel.c Normal file
View File