المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : مسااااعدة من فضلكم ******** c


داودي13
2011-12-14, 15:24
من فضلكم اريد مساعدة
ecrire un programme c qui demande le nom d un utudient ansi ses 3 notes puis calcule sa moyen et sa plus grandes et petite notes sela doive etre calculé par un fonction le programe affiche le nom et la moyen et lla plus grandes et petit notes

AbdessamedOuargla
2011-12-16, 01:11
#include<stdio.h>

float function( char name[], float p1, float p2, float p3)
{
float moyg, min, moy, max;
printf("The name of the student:%s\n", name);
moyg = (p1+p2+p3)/3;
printf("The average of the student is: %.2f\n", moyg);
if (p1==p2 && p1==p3)
{
printf("All the points are equal and is: %.f\n", p1);
goto end;
}
if (p1>p2 && p1>p3)
{
max=p1;
if(p2>p3)
{
moy=p2;
min=p3;
}
else
{
moy=p2;
min=p3;
}
}
else if (p2>p1 && p2>p3)
{
max=p2;
if(p1>p3)
{
moy=p1;
min=p3;
}
else

{
moy=p3;
min=p1;
}
}

else

{
max=p3;
if (p1>p2)
{
moy=p1;
min=p2;
}
else

{
moy=p2;
min=p1;
}

printf(
" the max point is: %.2f\n", max);
printf(" the moy point is: %.2f\n", moy);
printf(" the min point is: %.2f\n", min);
end:
return 0;
}
}

int
main(void)
{
float n1, n2, n3;
char names[100];
printf("Give the name of the student: ");
gets(names);
printf("Give the first point: ");scanf("%f", &n1);
printf("Give the second point: ");scanf("%f", &n2);
printf("Give the third point: ");scanf("%f", &n3);
function(names, n1, n2, n3);
system("pause");
}

كوثروا
2011-12-16, 15:04
le programme en dev c++

http://www.4shared.com/file/x1_y-zNq/etudiant_2.html




#include <iostream>
#include <stdlib.h>

float moyenne(float x,float y,float z)
{
return (x+y+z)/3;
}
float max( float x,float y,float z)
{
if (x>y && x>z) return x;
else if(y>x &&y>z) return y;
else return z;
}
float min(float x,float y,float z)
{
if(x<z &&x<y) return x;
else if(y<x && y<z) return y;
else return z;
}
using namespace std;




int main(int argc, char *argv[])
{
char nom[30];
float n1,n2,n3;
printf("entrez le nom\n ");
scanf("%s",nom);
printf("entrez la premiere note\n");
scanf("%f",&n1);
printf("entrez la deuxieme note\n");
scanf("%f",&n2);
printf("entrez la troisieme note\n");
scanf("%f",&n3);
printf("la moyenne est %f\n",moyenne(n1,n2,n3));
printf("le maximum est %f\n",max(n1,n2,n3));
printf("la minimum est %f\n",min(n1,n2,n3));


system("PAUSE");
return 0;
}

محب بلاده
2011-12-20, 23:49
ما معنى وفيماذا تستخدم

using namespace std;

AbdessamedOuargla
2011-12-21, 14:30
ما معنى وفيماذا تستخدم


using namespace std; Using namespace std: تستعمل من اجل الذين يستعملون compilateur من نوع C\C++
//Example sur namespace
namespace Djalfa
{
int abd, ben;
}
//نستعمل abd من اجل الوصول الى
Djalfa :: abd;
لعدم التكرار نستعمل using
std تضم جميع الاسماء في c++

سيرسنة
2011-12-21, 14:32
لم افهم جيدا عما تبحث