Therefore here is your complete, errorless working code in pure C. Can you spot all the changes I made?
Code:
/*
Virtual cell phone written in C to calculate cell phone usage.
Display cost per minute over the virtual phones service plan.
Displays the amount of service plan time used in Peak minutes and Off
peak minutes.
As more calls are made, the screen for the virtual phone will refresh
to display the changes made in minutes and costs.
*/
#include <stdio.h>
#include<ctype.h>
int main()
{
float Fee;
float Cost;
int Length, Off, Peak;
char Ans1, Ans2; // ,N, O, P, Y;
Cost = 0.00f;
Fee = 0.39f;
Length = Off = Peak = 0;
Ans1='Y';
while(true)
{
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf(" FFFFF A U U X X"
"\n F A A U U X X"
"\n FFFF A A U U X"
"\n F A A A A U U X X"
"\n F A A UUUUU X X"
"\n\n FFFF OOO NN N EEEE"
"\n F O O N N N E"
"\n FFF O O N N N EEEE"
"\n F O O N NN E"
"\n F OOO N N EEEE" );
printf("\n\nCost: $%.2f Peak: %d Off: %d", Cost, Peak, Off);
printf("\n\nWould you like to make a call?[Y/N] ");
scanf("%s", &Ans1);
if(Ans1 == 'Y' || Ans1 == 'y')
{
printf("How many minutes is the call?");
scanf("%d", &Length);
printf("Is that Peak or Off minutes?[P/O]");
scanf("%s", &Ans2);
Ans2 = toupper(Ans2);
if(Ans2 == 'P')
Peak = Peak + Length;
else
Off = Off + Length;
if(Peak > 30)
Cost += ((Peak - 30) * Fee);
if(Off > 200)
Cost += ((Off - 200) * Fee);
}
}
return 0;
} Good Luck!