برنامجك غير منطقي مثل ما قال الاخ ibn_alqalam
حاول تقراه وبتعرف اخطاءك مثلا while (1)ما احس ليها لزمة ولا فاهمة اش قصدك منها
ثانيا case e وش سالفته سواء اليوزر دخل n or y بيرجع لل main وبيقول عطني اسم الزبون
وبيعطيك المجموع صفر لان انت ما عطتيه قيمة صح ....بالنسبه لسالفه ان ما يقرا عدلت لك الكوندش
وصار يقرا عادي بس بعد هـ case مثل ماقلت ما لها سالفة ... حاول تعدله بروحك انا شلت ال while وعدلت الكوندش عشان يقرا الحرف ..
كود:
#include<stdio.h>
void Food(float *Total)
{
char S;
printf("selecting food type:\n");
printf("of the preakfast click:P\n");
printf("of the lunch click:L\n");
printf("of the dinner click\n");
printf("of the exit click:E\n");
scanf("%c",&S);
switch(S)
{
case'p':case'P':
*Total+=20;
break;
case'l':case'L':
*Total+=30;
break;
case'd':case'D':
*Total+=40;
break;
case'e':case'E':
{
char X;
printf("You sure of exit ? ,input Y or N:\n");
getchar();//here not see it,why?!!
scanf("%c",&X);//here not see it,why?!!
if(X !=(('Y')||('y')))
{
return;
}
default:
{
printf("input error!\n");
}
}
}
}
void Typing(char *n,float *Total)
{
printf("the name is:%s\n",n);
printf("the Total=%f\n",*Total);
}
void main()
{
float *Tt,i=0;//must set the value intlilty of i,like:i=0
char name[30];
Tt=&i;
Food(Tt);
printf("Please enter the name of patron:\n");
scanf("%s",&name);
Typing(name,Tt);
}