ELECTRONIQUE ELECTRICITE

19651211 Messages postés 6 Date d'inscription samedi 25 décembre 2010 Statut Membre Dernière intervention 19 septembre 2014 - 18 sept. 2014 à 14:59
NHenry Messages postés 15113 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 22 avril 2024 - 19 sept. 2014 à 12:30
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/100748-electronique-electricite

NHenry Messages postés 15113 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 22 avril 2024 159
19 sept. 2014 à 12:30
La source a été supprimée, regardes le commentaire de Whismeril.
19651211 Messages postés 6 Date d'inscription samedi 25 décembre 2010 Statut Membre Dernière intervention 19 septembre 2014
19 sept. 2014 à 11:21
Bonjour
je ne peut pas charger le code en fichier ZIP
19651211 Messages postés 6 Date d'inscription samedi 25 décembre 2010 Statut Membre Dernière intervention 19 septembre 2014
19 sept. 2014 à 11:13
#include "stdafx.h"
#include "ELECTRONIQUE & ELECTRICITE.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
#include <windows.h>

using namespace std;
void GotoXY( int x, int y );
void menue ();
void ClearScreen(void);
void ecrans_help ();
void LA_LOI_D_OHM ();
void PUISSANCE_ELECTRIQUE();
void CONDUCTEUR_OHMIQUE();
void PUISSANCE_ALTERNATIF();
void CODE_DE_COULEUR();
void color(int f);
void RESISTANCE_SERIE_ET_PARALLELE();


const char up (72), down(80), ok(13);
int main(int argc ,char * argv[])

{

Color(14);
GotoXY(20, 12);
cout << " L'ELECTRONIQUE & ELECTRICITE LES FORMULE " << endl;
GotoXY(20, 13);
cout << " Mr VENACTER FREDERIC " << endl;
GotoXY(20, 14);
cout << " TAPEZ SUR UNE TOUCHE " << endl;
fflush(stdout);
_getch();
ClearScreen ();
menue ();
while(1);
return 0;
}

/***************************************
* Affiche le menu *
***************************************/
void menue()
{
int choix;
{

GotoXY(3, 3);
printf ("1. LA LOI D'OHM ");
GotoXY(30, 6);
printf("2. PUISSANCE ELECTRIQUE ");
GotoXY(30, 8);
printf("3. RESISTANCE OHMIQUE ");
GotoXY(30, 10);
printf("4. PUISSANCE ALTERNATIVE ");
GotoXY(30, 12);
printf("5. CODE DE COULEUR ");
GotoXY(30, 14);
printf("6. RESISTANCE SERIE ET PARALLELE ");
GotoXY(30, 16);
printf(" VOTRE CHOIX ? ");
scanf("%d",&choix);

printf("\n");

switch (choix)
{
case 1: LA_LOI_D_OHM(); break;
case 2: PUISSANCE_ELECTRIQUE(); break;
case 3: CONDUCTEUR_OHMIQUE();break;
case 4: PUISSANCE_ALTERNATIF();break;
case 5: CODE_DE_COULEUR();break;
case 6: RESISTANCE_SERIE_ET_PARALLELE(); break;
}
}
}

/***************************************
* modifier l'emplacement du curseur *
***************************************/
void GotoXY( int x, int y )
{
COORD dwCursorPosition = { x, y };
SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), dwCursorPosition);
}

/***************************************
* LA_LOI_D_OHM *
***************************************/
void LA_LOI_D_OHM()
{

float TENSION, RESISTANCE, COURANT;
int choixFormul =0, Formul =0;
{

GotoXY(30, 20);
cout << " LA lOI D'OHM " << endl;
GotoXY(30, 22);
printf("1.TENSION ");
GotoXY(30, 24);
printf("2.COURANT ");
GotoXY(30, 26);
printf("3.RESISTANCE ");
GotoXY(30, 28);
printf(" VOTRE CHOIX ? ");
scanf("%d",&choixFormul);

printf("\n");
switch (choixFormul)
{
case 1:
GotoXY(30,32);
cout << "TENSION EN VOLT :\n" << endl;
GotoXY(30,34);
printf( "RESISTANCE "); cin >> RESISTANCE ;
GotoXY(30,36);
printf( "COURANT " ); cin >> COURANT;
TENSION = RESISTANCE * COURANT;
GotoXY(30, 38); Color(10);
cout << "TENSION " << TENSION << " VOLT \n"<< endl;
break;
case 2:
GotoXY(30,32);
cout << "COURANT EN AMPERE :\n " << endl;
GotoXY(30,34);
printf( "TENSION " ); cin >> TENSION ;
GotoXY(30,36);
printf ("RESISTANCE " ); cin >> RESISTANCE;
COURANT = TENSION / RESISTANCE ;
GotoXY(30, 38); Color(10);
cout << "COURANT " << COURANT << " AMPERE \n"<< endl;
break;
case 3:
GotoXY(30,32);
cout << "RESISTANCE EN OHM :\n " << endl;
GotoXY(30,34);
printf( "TENSION " ); cin >> TENSION ;
GotoXY(30,36);
printf( "COURANT " ); cin >> COURANT ;
RESISTANCE = TENSION / COURANT ;
GotoXY(30, 38); Color(10);
cout << "RESISTANCE " << RESISTANCE << " OHM /n"<< endl;
break;
}
Color(14);
cout << " TAPEZ SUR UNE TOUCHE POUR CONTINUER " << endl;

fflush(stdout);
_getch();
ClearScreen ();
menue ();
}
}


/***************************************
* PUISSANCE ELECTRIQUE *
***************************************/
void PUISSANCE_ELECTRIQUE()

{
float TENSION, COURANT, PUISSANCE;
int choixFormul =0, Formul =0;
{
GotoXY(30, 20);
Color(14);
cout << " PUISSANCE ELECTRIQUE " << endl;
GotoXY(30, 22);
printf("1.TENSION\n ");
GotoXY(30, 24);
printf("2.COURANT\n ");
GotoXY(30, 26);
printf("3.PUISSANCE\n ");
GotoXY(30, 38);
printf(" VOTRE CHOIX ? ");
scanf("%d",&choixFormul);

printf("\n");
switch (choixFormul)
{

case 1:
cout << "TENSION EN VOLT : " << endl;
printf(" PUISSANCE "); cin >> PUISSANCE;
printf (" COURANT " ); cin >> COURANT ;
TENSION = PUISSANCE * COURANT;
Color (10);
GotoXY(30, 37);
cout << "TENSION " << TENSION << " VOLT \n "<< endl;
break;
case 2:
Color (14);
cout << "COURANT EN AMPERE: " << endl;
printf ( "TENSION " ); cin >> TENSION;
printf ( "PUISSANCE " ); cin >> PUISSANCE;
COURANT = TENSION / PUISSANCE;
GotoXY(30, 37); Color (10);
cout << "COURANT " << COURANT << " AMPERE \n "<< endl;
break;
case 3:
Color (14);
cout << "PUISSANCE EN WATT : " << endl;
printf( "TENSION " ); cin >> TENSION;
printf( "COURANT " ); cin >> COURANT;
PUISSANCE = TENSION / COURANT;
GotoXY(30, 37); Color (10);
cout << "PUISSANCE " << PUISSANCE << " WATT \n "<< endl;

break;


}
Color(14);
cout << " TAPEZ SUR UNE TOUCHE POUR CONTINUER " << endl;

fflush(stdout);
_getch();
ClearScreen ();
menue ();

}
}
/***************************************
* CONDUCTEUR OHMIQUE *
***************************************/
void CONDUCTEUR_OHMIQUE()
{
float resistance =0, resistivite =0, longueur =0, section =0;
int choixFormul =0, Formul =0;
{
GotoXY(30, 22);
cout << " CONDUCTEUR OHMIQUE \n" << endl;
GotoXY(30, 24);
printf("1. RESISTANCE CONDUCTEUR \n");
GotoXY(30, 26);
printf("2. LONGUEUR CONDUCTEUR \n");
GotoXY(30, 28);
printf("3. SECTION CONDUCTEUR \n");
GotoXY(30, 30);
printf("4. RESISTIVITE CONDUCTEUR \n");
GotoXY(30, 32);
printf(" VOTRE CHOIX ? ");
scanf("%d",&choixFormul);
printf("\n");
switch (choixFormul)
{

case 1:
cout << "RESISTANCE_CONDUCTEUR_OHMIQUE EN OHM M :\n " << endl;
printf("RESISTIVITE CONDUCTEUR ");
cin >> resistivite ;
printf("LONGUEUR CONDUCTEUR ");
cin >> longueur ;
printf("SECTION CONDUCTEUR ");
cin >> section ;
resistance = (resistivite * longueur) / section;
cout << "RESISTANCE DU CONDUCTEUR " << resistance << " OHM/m "<< endl;
break;
case 2:
cout << "LONGUEUR DU CONDUCTEUR_OHMIQUE EN M :\n " << endl;
printf("RESISTIVITE CONDUCTEUR ");
cin >> resistivite ;
printf("RESISTANCE CONDUCTEUR ");
cin >> resistance ;
printf("SECTION CONDUCTEUR ");
cin >> section ;
longueur = (resistance * section) / resistivite;
cout << "LONGUER DU CONDUCTEUR " << longueur << " M "<< endl;
break;



}
Color (14);
cout << " TAPEZ SUR UNE TOUCHE POUR CONTINUER " << endl;
fflush(stdout);
_getch();
ClearScreen ();
menue ();
}
}

/***************************************
* LES TROIS PUISSANCE ALTERNATIF *
***************************************/
void PUISSANCE_ALTERNATIF()
{
float TENSION, COURANT, PUISSANCE_ACTIVE, PUISSANCE_REACTIVE, COSINUS, SINUS, PUISSANCE_APPARENTE, FACTEUR_DE_PUISSANCE;
int choixFormul, Formul;
{
GotoXY(30, 22);
cout << " Les Trois Puissance Alternatif \n" << endl;
GotoXY(30, 24);
printf("1. PUISSANCE ACTIVE \n");
GotoXY(30, 26);
printf("2.PUISSANCE REACTIVE \n");
GotoXY(30, 28);
printf("3. PUISSANCE APPARENTE \n");
GotoXY(30, 30);
printf("4. FACTEUR DE PUISSANCE \n");
GotoXY(30, 32);
printf(" VOTRE CHOIX ? ");
scanf("%d",&choixFormul);
printf("\n");
switch (choixFormul)
{
case 1:
cout << "LA PUISSANCE ACTIVE :\n " << endl;
printf( "TENSION " );
cin >> TENSION;
printf( "COURANT ");
cin >> COURANT;
printf( "COSINUS ");
cin >> COSINUS;
PUISSANCE_ACTIVE = TENSION * COURANT * COSINUS;
GotoXY(30, 40); Color(10);
cout << "PUISSANCE ACTIVE " << PUISSANCE_ACTIVE << endl;
break;
case 2:
Color(14);
cout << "LA PUISSANCE REACTIVE:\n " << endl;
printf( "TENSION ");
cin >> TENSION;
printf( "COURANT ");
cin >> COURANT;
printf( "SINUS ");
cin >> SINUS;
PUISSANCE_REACTIVE = TENSION * COURANT * SINUS;
GotoXY(30, 40); Color(10);
cout << "PUISSANCE REACTIVE " << PUISSANCE_REACTIVE << endl;
break;
case 3:
Color(14);
cout << "LA PUISSANCE APPARENTE:\n " << endl;
printf( "TENSION ");
cin >> TENSION;
printf( "COURANT ");
cin >> COURANT;
PUISSANCE_APPARENTE = TENSION * COURANT;
GotoXY(30, 40); Color(10);
cout << "PUISSANCE APPARENTE " << PUISSANCE_APPARENTE << endl;
break;

case 4:
Color(14);
cout << "FACTEUR DE PUISSANCE : " << endl;
printf( " PUISSANCE ACTIVE ");
cin >> PUISSANCE_ACTIVE;
printf( "PUISSANCE APPARENTE ");
cin >> PUISSANCE_APPARENTE;
FACTEUR_DE_PUISSANCE = PUISSANCE_ACTIVE / PUISSANCE_APPARENTE;
GotoXY(30, 40); Color(10);
cout << " FACTEUR DE PUISSANCE " << COSINUS << endl;
break;



}
GotoXY(30, 42);
Color(14);
cout << " TAPEZ SUR UNE TOUCHE POUR CONTINUER " << endl;
fflush(stdout);
_getch();
ClearScreen ();
menue ();
}
}
/***************************************
* CODE DE COULEUR *
***************************************/
void CODE_DE_COULEUR()
{
float DEUX_PREMIER_ANNEAU, TROIXIEME_ANNEAU,
QUATRIEME_ANNEAU, RESISTANCE, mRESISTANCE, pRESISTANCE, RESISTANCEE;

{
Color(14);
cout << " * PREMIER * DEUXIEME * TROIXIEME * QUATRIEME * \n";
cout << " NOIR * 0 * 0 * * * \n"; Color(6);
cout << " BRUN * 1 * 1 * 10 * +/-1% * \n"; Color(4);
cout << " ROUGE * 2 * 2 * 100 * +/-2% * \n"; Color(22);
cout << " ORAN * 3 * 3 * 1000 * * \n"; Color(14);
cout << " JAUNE * 4 * 4 * 10000 * * \n"; Color(10);
cout << " VERT * 5 * 5 * 100000 * +/-0,5% * \n"; Color(9);
cout << " BLEU * 6 * 6 * 1000000 * +/-0,25% * \n"; Color(13);
cout << " VIOL * 7 * 7 * * +/-0,1% * \n"; Color(8);
cout << " GRI * 8 * 8 * * * \n"; Color(15);
cout << " BLAN * 9 * 9 * * * \n"; Color(14);
cout << " OR * * * * 5% * \n"; Color(24);
cout << " ARGE * * * * 10% * \n\n\n";


Color(14);
printf(" VALEUR DES DEUX PREMIER ANNEAU ") ;cin >> DEUX_PREMIER_ANNEAU ;

printf(" VALEUR TROIXIEME ANNEAU "); cin >> TROIXIEME_ANNEAU;
printf(" VALEUR QUATRIEME ANNEAU "); cin>> QUATRIEME_ANNEAU;
GotoXY(30, 40); cout << " VALEUR RESISTANCE " << endl;

RESISTANCE = DEUX_PREMIER_ANNEAU * TROIXIEME_ANNEAU;

Color(10);
GotoXY(31, 43); cout << RESISTANCE << " ohm " << endl;
GotoXY(41, 43); cout << QUATRIEME_ANNEAU << " % \n"<< endl;
Color(14);
GotoXY(20, 45); printf(" LA RESISTANCE ET COMPRISSE ENTRE ");

RESISTANCEE = (RESISTANCE * QUATRIEME_ANNEAU) / 100;
mRESISTANCE = RESISTANCE - RESISTANCEE;
pRESISTANCE = RESISTANCE + RESISTANCEE;

Color(10);
GotoXY(20, 47); cout << mRESISTANCE << " ohm " << " et " << endl;
GotoXY(35, 47); cout << pRESISTANCE << " ohm \n\n " << endl;
}
GotoXY(30, 50);
Color(14);
cout << " TAPEZ SUR UNE TOUCHE POUR CONTINUER " << endl;
fflush(stdout);
_getch();
ClearScreen ();
menue ();
}
/***************************************
* RESISTANCE SERIE ET PARALLEL *
***************************************/
void RESISTANCE_SERIE_ET_PARALLELE()
{
float RESISTANCE1 =0, RESISTANCE2 =0, RESISTANCE3 =0, RESISTANCEre =0;
int choixFormul, Formul;
{
GotoXY(30, 22);
cout << " RESISTANCE SERIE ET PARALLELE \n" << endl;
GotoXY(30, 24);
printf("1. DEUX RESISTANCE EN SERIE \n");
GotoXY(30, 26);
printf("2. DEUX RESISTANCE EN PARALLELE \n");
GotoXY(30, 28);
printf("3. TROIS RESISTANCE EN SERIE \n");
GotoXY(30, 30);
printf("4. TROIS RESISTANCE EN PARALLELE \n");
GotoXY(30, 32);
printf(" VOTRE CHOIX ? ");
scanf("%d",&choixFormul);
printf("\n");
switch (choixFormul)
{


cout << "RESISTANCE SERIE ET PARALLEL :\n " << endl;
case 1:
printf("RESISTANCE1 "); cin >> RESISTANCE1 ;
printf("RESISTANCE2 "); cin >> RESISTANCE2 ;
RESISTANCEre = RESISTANCE1 + RESISTANCE2;
GotoXY(30, 36); Color(10);
cout << "RESISTANCAre " << RESISTANCEre << " OHM \n "<< endl;
break;
case 2:
printf("RESISTANCE1 "); cin >> RESISTANCE1 ;
printf("RESISTANCE2 "); cin >> RESISTANCE2 ;
RESISTANCEre = (RESISTANCE1 * RESISTANCE2) / (RESISTANCE1 + RESISTANCE2) ;
GotoXY(30, 36); Color(10);
cout << "RESISTANCAre " << RESISTANCEre << " OHM \n "<< endl;
break;
case 3:
printf("RESISTANCE1 "); cin >> RESISTANCE1 ;
printf("RESISTANCE2 "); cin >> RESISTANCE2 ;
printf("RESISTANCE3 "); cin >> RESISTANCE3 ;
RESISTANCEre = RESISTANCE1 + RESISTANCE2 + RESISTANCE3;
GotoXY(30, 36); Color(10);
cout << "RESISTANCAre " << RESISTANCEre << " OHM \n "<< endl;
break;
case 4:
printf("RESISTANCE1 "); cin >> RESISTANCE1 ;
printf("RESISTANCE2 "); cin >> RESISTANCE2 ;
printf("RESISTANCE3 "); cin >> RESISTANCE3 ;
RESISTANCEre = (1 / (1/RESISTANCE1 + 1/RESISTANCE2 + 1/RESISTANCE3));
GotoXY(30, 36); Color(10);
cout << "RESISTANCAre " << RESISTANCEre << " OHM \n "<< endl;
break;

}
Color(14);
cout << " TAPEZ SUR UNE TOUCHE POUR CONTINUER " << endl;
fflush(stdout);
_getch();
ClearScreen ();
menue ();
}
}


/***************************************
* efface le texte de la console *
***************************************/
void ClearScreen(void)
{
HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo (hstdout, &csbi))
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
DWORD dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter (hstdout, ' ', dwConSize, coordScreen, &cCharsWritten);
FillConsoleOutputAttribute (hstdout, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition (hstdout, coordScreen);
}
}

void Color(int texteColor)
{
HANDLE H=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(H,texteColor);
}
Whismeril Messages postés 19028 Date d'inscription mardi 11 mars 2003 Statut Non membre Dernière intervention 24 avril 2024 656
18 sept. 2014 à 17:29
Dans la description il est écrit qu'il s'agit d'un programme non terminé. C'est contraire à la charte, alors à quoi bon attendre qu'il le poste?
NHenry Messages postés 15113 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 22 avril 2024 159
18 sept. 2014 à 15:26
Bonjour,

Où est la source ?
A corriger rapidement sous peine de suppression.
Rejoignez-nous