السلام عليكم ورحمة الله وبركاته جميعاً ,,,
عضو جديد و أرجو عدم الإحراج !!!
مع العلم أني مبتدئ في دراسة لغة البورلند C++ طالب في الكلية.
أرجو أن تتفهموا الوضع وجزاكم الله خير الجزاء.
لدي سؤال قد تعبت في حله ولكن ......
.
.
.
لا نــــــــتـــــــــــــــــــــيـــــــــــجــــــــــة
تذكر !!
--------------------------------------------
أرجو أن لا تخذلوني في حله وهو برنامج آلة حاسبة ولكن باستخدام الـ(switch) والـ(do… while)
والـ(:case) والـ(break) والـ(default) والـ(getch())
---------------------------
والبرنامج كالتالي:
#include
main()
{
float nm1,nm2,result;
char op;
do{
printf("Enter the first number:n");
scanf("%f",&nm1);
printf("Enter the second number:n");
scanf("%f",&nm2);
printf("Enter the operation:n");
scanf("%c",&op);
switch(op)
{
case'+':
{
result=nm1+nm2;
printf("the result of nm1+nm2=%f",result);
break;
}
case'-':
{
result=nm1-nm2;
printf("the result of nm1-nm2=%f",result);
break;
}
case'*':
{
result=nm1*nm2;
printf("the result of nm1*nm2=%f",result);
break;
}
case'/':
{
result=nm1/nm2;
printf("the result of nm1/nm2=%f",result);
break;
}
default :
printf("you enter unknown operator:n");
printf("nAgain: (y/n)");
break;
}
}while((ch==getch()=='y'));
return(0);
}
&&&&&&&&&&&&&&&&&&&&&&&&&&&&
أرجو التجاوب من الجميع وأرجو إظهار الخطأ والسرعة في الرد وشكراً
لكم مرةً أخرى ,,,