Fonction GetKey - Programmation
TomsGuide.com : 700 000 inscrits répondent à toutes vos questions high-tech et informatique.
Pour obtenir de l'aide, inscrivez-vous gratuitement !
 




Mot :   Pseudo :  
 
Bas de page
Auteur
 Sujet : Fonction GetKey
 
Profil : IDNaute
Plus d'informations

Bonsoir est-ce que quelqu'un connait l'équivalent de la fonction GetKey(); sur DevC++ ou Visual C++ svp

merci.

Liens sponsorisés


Inscrivez-vous ou connectez-vous pour masquer ceci.

Profil : IDNaute
Plus d'informations

getchar(); ?


---------------
B800A0 8EC0 B400 B013 CD10 B91000 BA1000 B005
E81000 B407 CD21 B400 B003 CD10 B44C B000 CD21
50 89D0 BB4001 F7E3 89C7 01CF 58 26 8805 C3
Profil : IDNaute
Plus d'informations

oki merci j'ai un probleme avec mn programme il saute la partie modification d'une note...

un peu d'aide?

#define N 50
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <stdlib.h>

main()
{

//declaration des variables

float moyenne,somcoeff,somnum,EXX,EX,VX,V,coeff[N],note[N];
int nbnotes,i;
char reponse;

//acquisitions des données

printf("\n\tCalcul de la moyenne ponderee\n" );

do
{
printf("\n\tNombre de notes: " );
scanf("%d",&nbnotes);
}
while((nbnotes<=0)||(nbnotes>N));

printf("\n\tSaisies des notes:\t" );

for(i=0;i<nbnotes;i++)
{
printf("\n\tEntrer la note numero %d ",i+1);
scanf("%f",&note[i]);
printf("\n\tEntrer le coefficient numero %d ",i+1);
scanf("%f",&coeff[i]);
}


//affichage du tableau

printf("\n\tTableau des notes saisies\n" );
printf("\n\tnumero\tnote\tcoefficient\t" );
for(i=0;i<nbnotes;i++)
{
printf("\n\t%d\t%5.2f\t%5.2f",i+1,note[i],coeff[i]);
}

//modification d'une note

do
{
printf("\n\n\tVoulez-vous modifier une note (O/N)?" );
reponse=getchar();
if(reponse=='O')
{
do
{
printf("\n\tNumero de la note a modifier? " );
scanf("%d",&i);
}
while((i<1)||(i>nbnotes));
printf("\n\tNouvelle note numero %d ",i);
scanf("%f",&note[i-1]);
}
}
while(reponse=='O');

//traitement des donnees

printf("\n\n\tCalcul de la moyenne ponderee" );
for(moyenne=0,somcoeff=0,i=0;i<nbnotes;i++)
{
moyenne=moyenne+(note[i]*coeff[i]);
somcoeff=somcoeff+coeff[i];
}
moyenne=moyenne/somcoeff;
printf("\n\tLa moyenne ponderee est de: %5.2f",moyenne);

printf("\n\n\tCalcul de la variance" );
for(somnum=0,i=0;i<nbnotes;i++)
somnum=somnum+note[i]*note[i]*coeff[i];
EXX=somnum/somcoeff;
EX=moyenne;
VX=EXX-EX*EX;
printf("\n\tLa variance est de: %5.2f",VX);

printf("\n\n\tCalcul de l'ecart type" );
V=sqrt(VX);
printf("\n\tL'ecart type est de: %5.2f",V);

system("pause" );

} //fin du main


Profil : IDNaute
Plus d'informations

getchar() est non bloquant. S'il n'y a rien lorsque tu y passe, ça ne va pas attendre que l'utilisateur appuie sur une touche.

Apparemment, tu programme pour windows, alors tu peux tester _getche()


---------------
B800A0 8EC0 B400 B013 CD10 B91000 BA1000 B005
E81000 B407 CD21 B400 B003 CD10 B44C B000 CD21
50 89D0 BB4001 F7E3 89C7 01CF 58 26 8805 C3
Profil : IDNaute
Plus d'informations

jte remercie ca marche nickel t'aurais pas un lien avec les fonctions de dev c++?

merci.

Profil : IDNaute
Plus d'informations

non, en fait, tu as les fonctions standard C, ou les fonctions windows de la Win32 API (dont la doc de microsoft est sur MSDN, mais cette doc n'est pas facile à utiliser).


---------------
B800A0 8EC0 B400 B013 CD10 B91000 BA1000 B005
E81000 B407 CD21 B400 B003 CD10 B44C B000 CD21
50 89D0 BB4001 F7E3 89C7 01CF 58 26 8805 C3

Aller à :
 
  FORUM Infos-du-Net » Programmation » Fonction GetKey

Liens