Click here to Skip to main content
16,012,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ and C programming Pin
FarPointer18-Jan-06 8:17
FarPointer18-Jan-06 8:17 
QuestionRe: Visual C++ and C programming Pin
David Crow18-Jan-06 8:27
David Crow18-Jan-06 8:27 
AnswerRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 8:32
thierrypp18-Jan-06 8:32 
QuestionRe: Visual C++ and C programming Pin
David Crow18-Jan-06 8:39
David Crow18-Jan-06 8:39 
AnswerRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 8:57
thierrypp18-Jan-06 8:57 
AnswerRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 9:04
thierrypp18-Jan-06 9:04 
GeneralRe: Visual C++ and C programming Pin
David Crow18-Jan-06 9:16
David Crow18-Jan-06 9:16 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 9:25
thierrypp18-Jan-06 9:25 
honestly here I am a bit lost....

well ...here is an example of a typical c file, complete!

I have VC++ 6.0 standard edition.
But I am really a newbie in converting c files on VC++ 6.0

Maybe you could tell me how to proceed and which changes?

Usually, I click on the file and immediatelly the VC++ appears..

Thanks,
T
-------->example of a comple c file
/* ------------------ */
/* liste_structure2.c */
/* ------------------ */
#include <stdio.h>
#include <stdlib.h>

#define TAILLE_NOM 20
#define TAILLE_PRENOM 30

/* --- sous-programmes --- */
void saisie() ;
void affichage() ;
struct etudiant *recherche(char nom_recherche[]);
void modification() ;

/* --- variables globales --- */
struct etudiant {
struct etudiant *pred ;
char nom[TAILLE_NOM] ;
char prenom[TAILLE_PRENOM];
int age ;
struct etudiant *succ ;
} ;

struct etudiant *debut_liste,*fin_liste;
int nbeleves=0;

/* ===== PROGRAMME ===== */
main()
{
char choix=' ', ch_saisie[20];

debut_liste = NULL;
fin_liste = NULL;

while (choix!='q')
{
printf("-1- Saisie d'une liste\n");
printf("-2- Affichage\n");
printf("-3- Modification d'un Žlve\n");
printf("-q- quitter\n");
printf("Choix : ");
scanf("%s",ch_saisie);
choix=ch_saisie[0];

switch(choix)
{
case '1' : saisie();
break;
case '2' : affichage();
break;
case '3' : modification();
break;
case 'q' : printf("Au revoir\n");
break;
default : printf("Choix non valide\n");
break;
}
}
}
/* === chargement de la liste === */
void saisie()
{
struct etudiant *nouv_eleve,*eleve_actuel;
int termine = 0 ;
/* --- boucle de saisie --- */
while (! termine)
{
nouv_eleve = malloc(sizeof(struct etudiant));

printf("Entrez un nom ( nom=fin pour terminer):");
scanf("%s",nouv_eleve->nom);

termine=((strcmp(nouv_eleve->nom,"fin"))==0) ;

if (! termine) /* saisie du reste */
{
printf("Entrez un prŽnom:") ;
scanf("%s",nouv_eleve->prenom);

printf("Entrez un ‰ge:") ;
scanf("%d",&(nouv_eleve->age));

nouv_eleve->pred=NULL ;
nouv_eleve->succ=NULL ;

if (debut_liste == NULL)
{ /* Liste vide. C'est le seul element */
debut_liste = nouv_eleve ;
fin_liste = nouv_eleve ;
}
else
{ /* ajout en fin de liste */
fin_liste->succ = nouv_eleve ;
nouv_eleve->pred = fin_liste ;
fin_liste = nouv_eleve ;
}
/* on compte le nombre d'eleves */
nbeleves++ ;
}
}
}
/* === affichage === */
void affichage()
{
struct etudiant *eleve_actuel;
/* --- boucle d'affichage --- */
printf("--- %d Žlves ---\n",nbeleves);
eleve_actuel=debut_liste ;
while (eleve_actuel != NULL )
{
printf("%-10s",eleve_actuel->nom) ;
printf("%-10s",eleve_actuel->prenom);
printf("%3d\n",eleve_actuel->age) ;
eleve_actuel = eleve_actuel->succ ;
}
}
/* === recherche sur critere === */
struct etudiant *recherche(char nom_recherche[])
{
int trouve=0;
struct etudiant *eleve_actuel;
/* --- boucle de recherche --- */
eleve_actuel=debut_liste ;
while ((!trouve) && (eleve_actuel != NULL))
{
trouve=(strcmp(eleve_actuel->nom,nom_recherche)==0);
if (!trouve)
eleve_actuel = eleve_actuel->succ ;
}
if (!trouve)
eleve_actuel = NULL ;
return eleve_actuel ;
}

/* === modification === */
void modification()
{
char nom_modif[TAILLE_NOM];
struct etudiant *eleve_modif;
/* saisie du nom a modifier */
printf("Nom de l'Žlve:");
scanf("%s",nom_modif);
/* recherche */
eleve_modif=recherche(nom_modif);
if (eleve_modif!=NULL)
{
/* affichage */
printf("%-10s",eleve_modif->nom) ;
printf("%-10s",eleve_modif->prenom);
printf("%3d\n",eleve_modif->age) ;
/* modifications */
printf("Nouveau Nom : ");
scanf("%s",eleve_modif->nom);
printf("Nouveau Prenom : ");
scanf("%s",eleve_modif->prenom);
printf("Nouvel Age : ");
scanf("%d",&(eleve_modif->age));
}
else
printf("%s non trouvŽ\n",nom_modif);
}
GeneralRe: Visual C++ and C programming Pin
David Crow18-Jan-06 9:58
David Crow18-Jan-06 9:58 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 10:07
thierrypp18-Jan-06 10:07 
GeneralRe: Visual C++ and C programming Pin
BadKarma18-Jan-06 10:35
BadKarma18-Jan-06 10:35 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 10:42
thierrypp18-Jan-06 10:42 
GeneralRe: Visual C++ and C programming Pin
Graham Bradshaw18-Jan-06 9:10
Graham Bradshaw18-Jan-06 9:10 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 9:16
thierrypp18-Jan-06 9:16 
GeneralRe: Visual C++ and C programming Pin
BadKarma18-Jan-06 9:54
BadKarma18-Jan-06 9:54 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 9:58
thierrypp18-Jan-06 9:58 
GeneralRe: Visual C++ and C programming Pin
BadKarma18-Jan-06 10:07
BadKarma18-Jan-06 10:07 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 10:20
thierrypp18-Jan-06 10:20 
GeneralRe: Visual C++ and C programming Pin
David Crow18-Jan-06 10:04
David Crow18-Jan-06 10:04 
GeneralRe: Visual C++ and C programming Pin
BadKarma18-Jan-06 10:17
BadKarma18-Jan-06 10:17 
GeneralRe: Visual C++ and C programming Pin
Graham Bradshaw18-Jan-06 12:15
Graham Bradshaw18-Jan-06 12:15 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 12:34
thierrypp18-Jan-06 12:34 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 12:43
thierrypp18-Jan-06 12:43 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 9:48
thierrypp18-Jan-06 9:48 
AnswerRe: Visual C++ and C programming Pin
Rage19-Jan-06 0:04
professionalRage19-Jan-06 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.