hello everyone
I need help to correcting and executing the program
I wrote the program but program gives some errors like;

warning C4013: 'printf' undefined; assuming extern returning int
warning C4013: 'scanf' undefined; assuming extern returning int
: error C2046: illegal case
: error C2046: illegal case
fatal error C1004: unexpected end of file found
my program is :

int main ()
{

char A; char G; double a,b,c,d ;
double X,u,Y ; double campus,company,telecom,other;
double q,w,r; double h,j,t; char P; char C;
{


do

{

printf("Please enter the chosen program?\n");
printf("P: professional, G: progressive, C: campus>\n");
scanf("%c",&A);

while (!(A == 'P' || A == 'G' || A == 'C'))
{
printf("Invalid program, chose your program again >");
scanf("%c",&A);
}


switch (A)
{
case 'P' :
{
printf("Monthly standard fee of the program is 12.00 YTL\n");
printf("Please enter call durations in min for the program P\n");
printf("Within operator in off peak hours >\n");
scanf("%lf",&a);
printf("Within operator in peak hours >\n");
scanf("%lf",&b);
printf("Turkish telecom\n");
scanf("%lf",&c);
printf("other operators >\n");
scanf("%lf",&d);

u=(0.32*a+0.35*b+0.35*c+0.35*d) ;
X=u-12;
if (u == 12.00 || u < 12.00)

printf("The amount due from the customer is %.2f\n",u);
else

printf("The amount due from the customer is %.2f\n",X);
}
break;
}
case 'C' :
{
printf("Monthly standard fee of the program is 0.50 YTL\n");
printf("Please enter call durations in min for the program C\n");
printf("Within campus\n");
scanf("%lf",&campus);
printf("Within operator company\n");
scanf("%lf",&company);
printf("Turkish telecom\n");
scanf("%lf",&telecom);
printf("Other operators\n");
scanf("%lf",&other);

Y=(0.17*campus+0.26*company+0.26*telecom+0.60*other);

printf("The amount due from the customer is %.2f\n",Y);


break;
}
case 'G' :
{
printf("Monthly standard fee of the program is 0.00 YTL\n");
printf("Please enter call durations in min for the program G\n");
printf("Within operator company\n");
scanf("%lf",&q);
printf("Turkish telecom\n");
scanf("%lf",&w);
printf("other operators\n");
scanf("%lf",&r);
h=(0.39*q+0.39*w+0.60*r);
j=(0.33*q+0.39*w+0.60*r);
t=(0.29*q+0.39*w+0.60*r);
if ( q == 5 || q <5)

printf("The amount due from the customer is %.2f\n",h);
else if ( q>5 || q<=10 )
printf("The amount due from the customer is %.2f\n",j);
else
printf("The amount due from the customer is %.2f\n",t);
}
break;
}

can you please help me?

Recommended Answers

All 5 Replies

Start by including stdio.h and making sure your braces match, then we'll talk.

I'm sure that braces match, but can you please check that once again for me ?

>I'm sure that braces match
It's entirely possible that I've lost all proficiency with basic math, but I do believe that 6 and 8 are not equal. Either you're wrong, or you didn't post all of your code.

what you mean by 6 and 8 are not equal?

>what you mean by 6 and 8 are not equal?
6 closing braces, 8 opening braces. You're missing two closing braces, and missing braces are the usual suspect for an unexpected end of file error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.