string mot , R , R2 ; string mot; string msg ; float diviseur(float E, float R1, float R2)
int L ; int i,L; int i , L , b , a; {
cout<<"Entrer le verbe : "; cout<<"Donner le mot : "; cout<<"entrer le message : "; return E * R2 / (R1 + R2);
cin>>mot; cin>>mot; cin>>msg; }
L=[Link](); L=[Link]();
L=[Link](); for(i=L;i>=0;i--) for(i=0;i<L;i++) float res_parallele(float R1, float R2)
R=[Link](0,L-2); { { {
cout<<mot[i]; b=int(msg[i])+3; return (R1 * R2) / (R1 + R2);
L=[Link]()-1; } msg[i]=char(b); }
R2=[Link](L,1); } float res_serie (float R1,float R2)
cout<<msg<<endl; {
cout<<"Je "<<R<<"e"<<endl; for(i=0;i<L;i++) return R1+R2 ;
cout<<"Tu "<<R<<"es"<<endl; { }
cout<<"Il "<<R<<"e"<<endl; b=int(msg[i])-3;
if(R2=="g") msg[i]=char(b); float millman(float E1, float E2, float R1, float R2)
{ } {
cout<<"Nous "<<R<<"eons"<<endl; cout<<msg; return (E1 * R2 + E2 * R1) / (R1 + R2);
} }
else
{ float loi_d_ohm(float U, float I) {
cout<<"Nous "<<R<<"ons"<<endl; return U / I;
} }
cout<<"Vous "<<R<<"ez"<<endl;
cout<<"Ils "<<R<<"ent"<<endl; float res_de_protection(float E, float I, float Ud)
return (E - Ud) / I;
int MENU() { break; int N , secret ,oui,non,REP; Struct Etudiant {
int choix; case 5: srand(time(0)); string nom;
cout << "MENU" << endl; cout<< "**Loi d'Ohm : **" ; secret=rand()%100+1; int age;
cout << "4. Theorème de Millman" << endl; cout << "Entrez la tension E : "; while(N!=secret) string filiere;
cout << "5. Loi d'Ohm" << endl; cin >> E; {
cout << "6. Resistance de protection" << endl; cout << "Entrez l'intensité I : "; };
cout << "Entrez votre choix : "; cin >> I; cout<<"DEVINER LE NOMBRE"; int main() {
cin >> choix; cout<<"R ="<< loi_d_ohm(E, I) << endl; cin>>N;
return choix; break; if(N<secret) Etudiant etudiants[6];
} case 6: cout<<"Plus petit"<<endl;
int main() cout << "**Résistance de protection **"; if(N>secret) for (int i = 0; i < 6; i++) {
{ cout << "Entrez la tension de seuil Ud : "; cout<<"Plus grand"<<endl; cout << "Entrez les informations de l'étudiant " << i + 1 ;
float E, R1, R2, I, Ud, E1, E2; cin >> Ud; } cout << "Nom: ";
string c; cout << "Entrez la tension E : "; cout<<"Juste"; cin>> etudiants[i].nom;
int choix; cin >> E; cout << "Age: ";
do cout << "Entrez l'intensité I : "; cin >> etudiants[i].age;
{ cin >> I; cout << "Filière: ";
choix = MENU(); cout << "R ="<<res_de_protection(E, I, Ud) << endl; cin>> etudiants[i].filiere;
switch (choix) break; }
{ default:
case 4: cout << "Choix invalide!" << endl;
cout << "**Théorème de Millman **"; break; for (int i = 0; i < 6; i++) {
cout << "Entrez la tension E1 : "; } cout << "Nom: " << etudiants[i].nom << ", Age: " << etudiants[i].age << ", Filière: " <<
etudiants[i].filiere <<endl;
cin >> E1; cout << "Voulez-vous continuer ? (oui/non) : ";
}
cout << "Entrez la tension E2 : "; cin >> c;
cin >> E2; } while (c == "oui");
return 0;
cout <<"U ="<< millman(E1, E2, R1, R2) << endl;