Aide pour 1er partie c++

kasawi2011 Messages postés 3 Date d'inscription   Statut Membre Dernière intervention   -  
kasawi2011 Messages postés 3 Date d'inscription   Statut Membre Dernière intervention   -
salut a tout je suis nouveau sur le site et débutant sur langage c++
alors mon petite histoire :-° que j'ai raté mon cour de c++ plusieurs fois et il on créé un petite programme je les découper en plusieurs parties voila la 1er partie S.V.P je veux que vous m'expliquer ligne par ligne

je n'oublier pas votre aide et merci d'avance .
____________________________________________________________________
#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 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;

}

(logiciel turbo c++)
____________________________________________________________________
j'ai lu plusieurs chapitre dans se site du langage c++ mais j'ai du problème avec les tableau


2 réponses

kasawi2011 Messages postés 3 Date d'inscription   Statut Membre Dernière intervention  
 
j'attende
0
kasawi2011 Messages postés 3 Date d'inscription   Statut Membre Dernière intervention  
 
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');

}
0