Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Bibliothèques
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- #include <myconio.h>
- #include <math.h>
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Define
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Main
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- void main (void){
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Initialisations
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- int ligne,colonne;
- int positionX,positionY=8;
- int ecrireX=45,ecrireY=11;
- char tableauNom[7][92]={" __ ",
- " _____ _____ |__| ",
- " ___| __ _|__ ______ __ _ ______ __|__ |__ ____ ___ _ __ _____ ",
- "| \\/ \\| || ___|\\ \\ //| ___| | \\ || \\\\ \\ //| || \\ ",
- "| /\\ || ___| \\ \\// | ___| | D \\ || A \\\\ \\// | || D \\ ",
- "|____/ \\____||______| \\__/ |______| |______/ __||__|\\__\\\\__/ |__||______/ ",
- " |_____| |_____| "};
- char tableau [10] [65]={" /\\ /\\ _______________________________________ ",
- " //\\\\_____//\\\\ / ",
- "( o o ) / ",
- "( >< ) < ",
- "(_ _) \\ ",
- " ( ) \\_______________________________________ ",
- " ( ) ",
- " | | | ",
- " | | | ",
- " (____)____) "};
- char presentation[43]={"Ceci est un exercice pr\202sent\202 par : "};
- int decimal,Temp,affichageX=55,Cpt=0,binaire=0;
- char lettre;
- char choix=' ';
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Mise en page
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- textcolor(LIGHTGREEN);
- textbackground(BLACK);
- MYwindow(1,1,100,40);
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Affichage du Chat
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- for (ligne=0;ligne<10;ligne++)
- {
- positionX=20;
- for (colonne=0;colonne<65;colonne++)
- {
- gotoxy(positionX,positionY);printf("%c",tableau[ligne][colonne]);
- Sleep(5);
- positionX++;
- }
- positionY++;
- }
- Sleep(500);
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Affichage message
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- for (ligne=0;ligne<43;ligne++)
- {
- gotoxy(ecrireX,ecrireY);printf("%c",presentation[ligne]);
- Sleep(20);
- ecrireX++;
- }
- Sleep(1250);
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Affichage Nom
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- for (ligne=0;ligne<7;ligne++)
- {
- positionX=10;
- for (colonne=0;colonne<92;colonne++)
- {
- gotoxy(positionX,positionY);printf("%c",tableauNom[ligne][colonne]);
- Sleep(5);
- positionX++;
- }
- positionY++;
- }
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Attente
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- Sleep(5000);
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Mise en page Exercice
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- MYwindow(1,1,100,50);
- textbackground(WHITE); MYclrwin(1,1,100,50);
- textbackground(DARKGRAY); MYclrwin(10,3,90,3);
- gotoxy(20,3);textcolor(LIGHTCYAN); printf("Convertir de D\202\cimal en binaire, octal ou hexad\202\cimal");
- gotoxy(82,3);textcolor(BLACK);printf("|\26||\376|");
- textcolor(LIGHTRED);gotoxy(88,3);printf("|X|");
- textbackground(BLACK); MYclrwin(10,4,90,58);
- textcolor(LIGHTGREEN);
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Demande de Variable et affichage
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- gotoxy(30,4);printf("Quel nombre d\202\cimal voulez-vous transformer ? ");
- gotoxy(49,5);scanf("%d",&decimal);
- gotoxy(20,7);printf("Voulez-vous le transformer en binaire, en hexad\202\cimale ou en octal ?");
- gotoxy(37,8);printf("Merci de rentrer votre choix : ");
- gotoxy(35,9);printf("1. Pour transformer en Binaire");
- gotoxy(35,10);printf("2. Pour transformer en Hexad\202\cimale");
- gotoxy(35,11);printf("3. Pour transformer en Octal");
- do
- {
- gotoxy(49,12);scanf("%c",&choix);
- }while(choix != '1' && choix != '2' && choix != '3');
- switch(choix)
- {
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Transformation en binaire
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- case '1':
- gotoxy(35,14);printf("Vous avez choisi la transformation en binaire");
- do
- {
- Temp=decimal%2;
- decimal/=2;
- gotoxy(affichageX,15);printf("%d", Temp);
- affichageX--;
- Cpt++;
- if(Cpt%4==0)
- {
- affichageX--;
- }
- }while (decimal!=0);
- break;
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- transformation en Hexa
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- case '2':
- do
- {
- gotoxy(35,14);printf("Vous avez choisi la transformation en Hexa");
- Temp=decimal%16;
- decimal=decimal/16;
- switch(Temp)
- {
- case 10: lettre='A';break;
- case 11: lettre='B';break;
- case 12: lettre='C';break;
- case 13: lettre='D';break;
- case 14: lettre='E';break;
- case 15: lettre='F';break;
- default : gotoxy(affichageX,15);printf("%d",Temp);break;
- }
- if(Temp>=10)
- {
- gotoxy(affichageX,15);printf("%c",lettre);
- }
- affichageX--;
- }while(decimal!=0);
- break;
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Transformation en Octal
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- default:
- gotoxy(35,14);printf("Vous avez choisi la transformation en Octal");
- do
- {
- Temp=decimal%8;
- decimal/=8;
- gotoxy(affichageX,15);printf("%d", Temp);
- affichageX--;
- Cpt++;
- }while (decimal!=0);
- break;
- }
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Pause
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- gotoxy(11,30);textcolor(BLACK);system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement