Blem de compilation
zeus
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
j'arrive pas à repérer quel est le problème en ce programme!svp aidez moi:
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
typedef struct{
char nom[40];
float note;
}etudiant;
etudiant t[5],permu ;
int i,j,comp,comp1,choix;
char X[40];
float x;
void remplissage();
void affichage();
void trinom();
void trinote();
void rechseqnom();
void rechseqnote();
void remplissage()
{
for(i=0;i<5;i++)
{ printf("\n etudiant N: %d \t",i+1);
printf("\n\n donnez le nom : \n ");
scanf("%s",t[i].nom);
printf("\n donnez la note : \n ");
scanf("%f",&t[i].note);
}
}
void affichage()
{
for(i=0;i<5;i++)
{ printf("\n \n etudiant N: %d \t",i+1);
printf(" \n NOM ETUDIANT : %s",t[i].nom);
printf(" \n NOTE ETUDIANT : %f",&t[i].note);
}
}
void trinote()
{
for(i=0;i<4;i++)
{
for(j=i+1;j<5;j++)
{
if(t[i].note<t[j].note)
{ permu=t[i];
t[i]=t[j];
t[j]=permu;
}
}
}
}
void trinom()
{
for(i=0;i<4;i++)
{
for(j=i+1;j<5;j++)
{
comp=strcmp(t[i].nom,t[j].nom);
if(comp<0)
{ permu=t[i];
t[i]=t[j];
t[j]=permu;
}
}
}
}
void rechseqnote()
{
printf("\n entrez la note que vous recherchez :");
scanf("%f",&x);
for(i=0;i<5;i++)
{
if(t[i].note==x)
{
printf("\n la note recherche existe effectivement dans la liste des etudiants ");
}
else
{
printf("\n la note recherche n'existe pas dans la liste des etudiants ");
}
}
}
void rechseqnom()
{
printf("\n entrez le nom que vous recherchez :");
scanf("%s",X);
for(i=0;i<5;i++)
{
comp1=strcmp(t[i].nom,X);
if(comp1==0)
{
printf("\n la note recherche existe effectivement dans la liste des etudiants ");
}
else
{
printf("\n la note recherche n'existe pas dans la liste des etudiants ");
}
}
}
int main()
{
void remplissage();
printf("\n ------------------------------bienvenue dans l'application de la gestion des notes--------------------------------\n");
printf("\n\n pour etablir un tri par nom tapez 1");
printf("\n\n pour etablir un tri par note tapez 2");
printf("\n\n pour etablir une recherche par nom tapez 3");
printf("\n\n pour etablir une recherche par note tapez 4");
printf("\n\n pour quitter l'application tapez 0 \n\n");
scanf("%d",&choix);
switch(choix) ;
{
case 1:
remplissage();
trinom();
affichage();
break;
case 2:
remplissage();
trinote();
affichage();
break;
case 3:
remplissage();
rechseqnom();
affichage();
break;
case 4:
remplissage();
rechseqnote();
affichage();
break;
}
getch();
}
j'arrive pas à repérer quel est le problème en ce programme!svp aidez moi:
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
typedef struct{
char nom[40];
float note;
}etudiant;
etudiant t[5],permu ;
int i,j,comp,comp1,choix;
char X[40];
float x;
void remplissage();
void affichage();
void trinom();
void trinote();
void rechseqnom();
void rechseqnote();
void remplissage()
{
for(i=0;i<5;i++)
{ printf("\n etudiant N: %d \t",i+1);
printf("\n\n donnez le nom : \n ");
scanf("%s",t[i].nom);
printf("\n donnez la note : \n ");
scanf("%f",&t[i].note);
}
}
void affichage()
{
for(i=0;i<5;i++)
{ printf("\n \n etudiant N: %d \t",i+1);
printf(" \n NOM ETUDIANT : %s",t[i].nom);
printf(" \n NOTE ETUDIANT : %f",&t[i].note);
}
}
void trinote()
{
for(i=0;i<4;i++)
{
for(j=i+1;j<5;j++)
{
if(t[i].note<t[j].note)
{ permu=t[i];
t[i]=t[j];
t[j]=permu;
}
}
}
}
void trinom()
{
for(i=0;i<4;i++)
{
for(j=i+1;j<5;j++)
{
comp=strcmp(t[i].nom,t[j].nom);
if(comp<0)
{ permu=t[i];
t[i]=t[j];
t[j]=permu;
}
}
}
}
void rechseqnote()
{
printf("\n entrez la note que vous recherchez :");
scanf("%f",&x);
for(i=0;i<5;i++)
{
if(t[i].note==x)
{
printf("\n la note recherche existe effectivement dans la liste des etudiants ");
}
else
{
printf("\n la note recherche n'existe pas dans la liste des etudiants ");
}
}
}
void rechseqnom()
{
printf("\n entrez le nom que vous recherchez :");
scanf("%s",X);
for(i=0;i<5;i++)
{
comp1=strcmp(t[i].nom,X);
if(comp1==0)
{
printf("\n la note recherche existe effectivement dans la liste des etudiants ");
}
else
{
printf("\n la note recherche n'existe pas dans la liste des etudiants ");
}
}
}
int main()
{
void remplissage();
printf("\n ------------------------------bienvenue dans l'application de la gestion des notes--------------------------------\n");
printf("\n\n pour etablir un tri par nom tapez 1");
printf("\n\n pour etablir un tri par note tapez 2");
printf("\n\n pour etablir une recherche par nom tapez 3");
printf("\n\n pour etablir une recherche par note tapez 4");
printf("\n\n pour quitter l'application tapez 0 \n\n");
scanf("%d",&choix);
switch(choix) ;
{
case 1:
remplissage();
trinom();
affichage();
break;
case 2:
remplissage();
trinote();
affichage();
break;
case 3:
remplissage();
rechseqnom();
affichage();
break;
case 4:
remplissage();
rechseqnote();
affichage();
break;
}
getch();
}
A voir également:
- Blem de compilation
- Breach compilation c'est quoi - Guide
- Erreur de compilation projet ou bibliothèque introuvable - Forum VB / VBA
- Message d'erreur Excel projet ou bibliotheque introuvable ! - Forum Excel
- Must declare a named package because this compilation unit is associated to the named module - Forum Java
- Erreur de compilation ✓ - Forum Excel
3 réponses
Bonjour
D'abord c'et très vilain de se plaindre d'une erreur de compilation sans recopier le message d'erreur.
Ensuite, c'est très vilain aussi de déclarer globales (en dehors de toute fonction) des variables qui devraient être locales. Mais dans ton cas, le problème n'est pas là.
Tu as (au moins) une erreur : le point virgule près le switch. Il devrait y avoir
sans point virgule
Bonne programmation
D'abord c'et très vilain de se plaindre d'une erreur de compilation sans recopier le message d'erreur.
Ensuite, c'est très vilain aussi de déclarer globales (en dehors de toute fonction) des variables qui devraient être locales. Mais dans ton cas, le problème n'est pas là.
Tu as (au moins) une erreur : le point virgule près le switch. Il devrait y avoir
switch(choix)
{
sans point virgule
Bonne programmation
in function 'int main()'
case label '1' not within a switch statement
break statement not within loop or switch
case label '2' not within a switch statement
break statement not within loop or switch
case label '3' not within a switch statement
break statement not within loop or switch
case label '4' not within a switch statement
break statement not within loop or switch
voila le msg d'erreur!
merci bcp
case label '1' not within a switch statement
break statement not within loop or switch
case label '2' not within a switch statement
break statement not within loop or switch
case label '3' not within a switch statement
break statement not within loop or switch
case label '4' not within a switch statement
break statement not within loop or switch
voila le msg d'erreur!
merci bcp