Aide pour 1er partie c++
Fermé
kasawi2011
Messages postés
3
Date d'inscription
lundi 19 décembre 2011
Statut
Membre
Dernière intervention
19 décembre 2011
-
19 déc. 2011 à 12:29
kasawi2011 Messages postés 3 Date d'inscription lundi 19 décembre 2011 Statut Membre Dernière intervention 19 décembre 2011 - 19 déc. 2011 à 14:10
kasawi2011 Messages postés 3 Date d'inscription lundi 19 décembre 2011 Statut Membre Dernière intervention 19 décembre 2011 - 19 déc. 2011 à 14:10
A voir également:
- Aide pour 1er partie c++
- Flouter une partie d'une photo - Guide
- 1er en haut - Forum Windows
- Cette adresse de messagerie fait partie d’un domaine réservé. entrez une autre adresse de messagerie - Forum Hotmail / Outlook.com
- Recherche de partie infini warzone 2 - Forum Jeux PC
- Excel si cellule contient partie texte ✓ - Forum Excel
2 réponses
kasawi2011
Messages postés
3
Date d'inscription
lundi 19 décembre 2011
Statut
Membre
Dernière intervention
19 décembre 2011
19 déc. 2011 à 13:55
19 déc. 2011 à 13:55
j'attende
kasawi2011
Messages postés
3
Date d'inscription
lundi 19 décembre 2011
Statut
Membre
Dernière intervention
19 décembre 2011
19 déc. 2011 à 14:10
19 déc. 2011 à 14:10
le code entier
_______________________________________________
#include<conio.h>
#include<iostream.h>
#include<string.h>
int i=0;
class matiere
{
public:
int num_mat;
char nom[10];
int coeff;
float note;
} ;
class etudiant
{
public:
int num_etd;
char nom[10];
matiere mat[3];
float mg;
char resultat[12];
void remplissage();
void rechercher();
void modification();
void modification_matiere();
int admis();
}etd,t[10];
void interface()
{
clrscr();
gotoxy(5,5);cout<<"n_etd:";
gotoxy(5,8);cout<<"nom:";
gotoxy(20,12);cout<<"num_mat:";
gotoxy(30,12);cout<<"nom";
gotoxy(40,12);cout<<"coeff:";
gotoxy(50,12);cout<<"note:";
}
void etudiant::remplissage()
{
int j,k=15;
float s=0;
int r=0;
interface();
gotoxy(15,5);cin>>t[i].num_etd;
while(t[i].num_etd!=0)
{
s=0;r=0;
gotoxy(15,8);cin>>t[i].nom;
k=15;
for(j=0;j<=2;j++)
{
gotoxy(20,k);
cin>>t[i].mat[j].num_mat;
gotoxy(30,k);
cin>>t[i].mat[j].nom;
gotoxy(40,k);
cin>>t[i].mat[j].coeff;
gotoxy(50,k);
cin>>t[i].mat[j].note;
r=r+t[i].mat[j].coeff;
s=s+t[i].mat[j].coeff*t[i].mat[j].note;
k++;
}
t[i].mg=s/r;
if(t[i].mg>=10)
strcpy(t[i].resultat,"admis");
else
strcpy(t[i].resultat,"non admis");
i++;
interface();
gotoxy(15,5);cin>>t[i].num_etd;
}
}
void etudiant ::rechercher()
{
int numero,j,v=0,l;
clrscr();
cout<<"numero:";
cin>>numero;
for(j=0;j<i;j++)
{
if(numero==t[j].num_etd){v=1;cout<<"num_etd:"<<t[j].num_etd;
cout<<"nom:"<<t[j].nom;
for(l=0;l<=2;l++)
{
cout<<t[j].mat[l].num_mat<<" "<<t[j].mat[l].nom<<" "<<t[j].mat[l].coeff<<" "<<t[j].mat[l].note<<"\n";
}
cout<<"moyenne:"<<t[j].mg;
cout<<"resultat:"<<t[j].resultat;
}
}
if (v==0){cout<<"n'existe pas";}
getch();
}
void etudiant::modification()
{
int numero,v=0,j,l;
clrscr();
cout<<"numero_etudiant:";
cin>>numero;
for(j=0;j<i;j++)
{
if(numero==t[j].num_etd){v=1;cout<<"num_etd:"<<t[j].num_etd;
cout<<"nom:"<<t[j].nom;
for(l=0;l<=2;l++)
{
cout<<t[j].mat[l].num_mat<<" "<<t[j].mat[l].nom<<" "<<t[j].mat[l].coeff<<" "<<t[j].mat[l].note<<"\n";
}
cout<<"moyenne:"<<t[j].mg;
cout<<"resultat:"<<t[j].resultat;
}
}
if (v==0){cout<<"n'existe pas";}
getch();
}
void etudiant::modification_matiere()
{
int num, numero,v=0,j,l,k,w=0;
clrscr();
cout<<"numero_etudiant:";
cin>>numero;
for(j=0;j<i;j++)
{
if(numero==t[j].num_etd){v=1;l=j;};
}
if(v==0){cout<<"etd introuvable!!!";}
else{cout<<"num_matiere:";
cin>>num;
for(k=0;k<=2;k++)
{
if(numero==t[l].mat[k].num_mat)
{
w=1;cout<<"num_matiere:";
cin>>t[l].mat[k].nom;
}
}
if(w==0){cout<<"matiere introuvable!!!";}
}
getch();
}
int etudiant::admis()
{
int j,n=0;
for(j=0;j<i;j++)
{
if(t[j].mg>=10){n++;}
}
return n;
}
void main()
{
char p;
do
{
clrscr();
cout<<"\n\na_remplissage";
cout<<"\n\nb_rechercher";
cout<<"\n\nm_modification";
cout<<"\n\nd_modification_matiere";
cout<<"\n\ni_admis";
cout<<"\n\nq_quitter";
cout<<"\n\nchoix";
p=getch();
switch(p)
{
case 'a':etd.remplissage();break;
case 'b':etd.rechercher();break;
case 'm':etd.modification();break;
case 'd':etd.modification_matiere();break;
case 'i':{ clrscr();cout<<"le nombre des admis est:"<<etd.admis();getch();}break;
}
}
while(p!='q');
}
_______________________________________________
#include<conio.h>
#include<iostream.h>
#include<string.h>
int i=0;
class matiere
{
public:
int num_mat;
char nom[10];
int coeff;
float note;
} ;
class etudiant
{
public:
int num_etd;
char nom[10];
matiere mat[3];
float mg;
char resultat[12];
void remplissage();
void rechercher();
void modification();
void modification_matiere();
int admis();
}etd,t[10];
void interface()
{
clrscr();
gotoxy(5,5);cout<<"n_etd:";
gotoxy(5,8);cout<<"nom:";
gotoxy(20,12);cout<<"num_mat:";
gotoxy(30,12);cout<<"nom";
gotoxy(40,12);cout<<"coeff:";
gotoxy(50,12);cout<<"note:";
}
void etudiant::remplissage()
{
int j,k=15;
float s=0;
int r=0;
interface();
gotoxy(15,5);cin>>t[i].num_etd;
while(t[i].num_etd!=0)
{
s=0;r=0;
gotoxy(15,8);cin>>t[i].nom;
k=15;
for(j=0;j<=2;j++)
{
gotoxy(20,k);
cin>>t[i].mat[j].num_mat;
gotoxy(30,k);
cin>>t[i].mat[j].nom;
gotoxy(40,k);
cin>>t[i].mat[j].coeff;
gotoxy(50,k);
cin>>t[i].mat[j].note;
r=r+t[i].mat[j].coeff;
s=s+t[i].mat[j].coeff*t[i].mat[j].note;
k++;
}
t[i].mg=s/r;
if(t[i].mg>=10)
strcpy(t[i].resultat,"admis");
else
strcpy(t[i].resultat,"non admis");
i++;
interface();
gotoxy(15,5);cin>>t[i].num_etd;
}
}
void etudiant ::rechercher()
{
int numero,j,v=0,l;
clrscr();
cout<<"numero:";
cin>>numero;
for(j=0;j<i;j++)
{
if(numero==t[j].num_etd){v=1;cout<<"num_etd:"<<t[j].num_etd;
cout<<"nom:"<<t[j].nom;
for(l=0;l<=2;l++)
{
cout<<t[j].mat[l].num_mat<<" "<<t[j].mat[l].nom<<" "<<t[j].mat[l].coeff<<" "<<t[j].mat[l].note<<"\n";
}
cout<<"moyenne:"<<t[j].mg;
cout<<"resultat:"<<t[j].resultat;
}
}
if (v==0){cout<<"n'existe pas";}
getch();
}
void etudiant::modification()
{
int numero,v=0,j,l;
clrscr();
cout<<"numero_etudiant:";
cin>>numero;
for(j=0;j<i;j++)
{
if(numero==t[j].num_etd){v=1;cout<<"num_etd:"<<t[j].num_etd;
cout<<"nom:"<<t[j].nom;
for(l=0;l<=2;l++)
{
cout<<t[j].mat[l].num_mat<<" "<<t[j].mat[l].nom<<" "<<t[j].mat[l].coeff<<" "<<t[j].mat[l].note<<"\n";
}
cout<<"moyenne:"<<t[j].mg;
cout<<"resultat:"<<t[j].resultat;
}
}
if (v==0){cout<<"n'existe pas";}
getch();
}
void etudiant::modification_matiere()
{
int num, numero,v=0,j,l,k,w=0;
clrscr();
cout<<"numero_etudiant:";
cin>>numero;
for(j=0;j<i;j++)
{
if(numero==t[j].num_etd){v=1;l=j;};
}
if(v==0){cout<<"etd introuvable!!!";}
else{cout<<"num_matiere:";
cin>>num;
for(k=0;k<=2;k++)
{
if(numero==t[l].mat[k].num_mat)
{
w=1;cout<<"num_matiere:";
cin>>t[l].mat[k].nom;
}
}
if(w==0){cout<<"matiere introuvable!!!";}
}
getch();
}
int etudiant::admis()
{
int j,n=0;
for(j=0;j<i;j++)
{
if(t[j].mg>=10){n++;}
}
return n;
}
void main()
{
char p;
do
{
clrscr();
cout<<"\n\na_remplissage";
cout<<"\n\nb_rechercher";
cout<<"\n\nm_modification";
cout<<"\n\nd_modification_matiere";
cout<<"\n\ni_admis";
cout<<"\n\nq_quitter";
cout<<"\n\nchoix";
p=getch();
switch(p)
{
case 'a':etd.remplissage();break;
case 'b':etd.rechercher();break;
case 'm':etd.modification();break;
case 'd':etd.modification_matiere();break;
case 'i':{ clrscr();cout<<"le nombre des admis est:"<<etd.admis();getch();}break;
}
}
while(p!='q');
}