PASCAL CODE FIX
Posted by mark123
Last Updated: March 17, 2012
//Develop an algorithm or write pseudocode that accepts as input the names
//of an unspecified number of masqueraders who each have paid the full cost
//of their costume and the amount each has paid.

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
char fullname[40];
int amount;
char answer;
char choice;
char section1[20]={"Masquerader Dancers"};
char section2[20]={"White Panthers"};
char section3[20]={"Red Brigade"};
char section4[20]={"The Tailors"};
char section5[20]={"Night Riders"};    
int total1,total2,total3,total4,total5,totalam1;
int totalam2,totalam3,totalam4,totalam5;
total1=0,total2=0,total3=0,total4=0,total5=0;
totalam1=0,totalam2=0,totalam3=0,totalam4=0,totalam5=0;

printf("Do you want to add a masquerader?");
fflush(stdin);
scanf("%c",&answer);
while(answer=='y'||answer=='y')
{
printf("Please enter the full name of the masquerader:");
scanf("%s",&fullname);
printf("Do you have a balance on your account?\n");
fflush(stdin);
scanf("%c",&choice);
if(choice=='y'||choice=='Y')
{
printf("You must pay the full cost before being accepted\n");
}
else
if(choice=='n'||choice=='N')
{
printf("You may continue the registration process\n");
printf("Please enter the amount you have paid:\n");
scanf("%d",&amount);
if(amount==180)
{
printf("The name %s is assigned to",fullname);
printf(" Section 1: %s",section1);
total1+=1;
totalam1=totalam1+amount;
}
else if(amount==240)
{
printf("The name %s is assigned to",fullname);
printf("Section 2: %s Masquerader",section2);
total2+=1;
totalam2=totalam2+amount;
}
else if(amount==300)
{
printf("The name %s is assigned to",fullname);
printf("Section 3: %s Masqueraders",section3);
total3+=1;
totalam3=totalam3+amount;
}
else if(amount==370)
{
printf("The name %s is assigned to",fullname);
printf("Section 4: %s Masqueraders",section4);
total4+=1;
totalam4=totalam4+amount;
}
else if(amount==445)
{
printf("The name %s is assigned to",fullname);
printf("Section 5: %s Masqueraders",section5);
total5+=1;
totalam5=totalam5+amount;
}
else
{
printf("You must enter $180,$240,$300,$370,$445");
}
}
printf("Any more entries?");
fflush(stdin);
scanf("%c",&answer);
if(answer=='N'||answer=='n')
{
printf("Entry process completed\n");
}
}
printf("Name of Person: %s",fullname);
printf("Section 1: %s Total persons: %d  Total paid :%d",section1,total1,totalam1);
printf("Section 2: %s Total persons: %d  Total Paid: %d",section2,total2,totalam2);
printf("Section 3: %s  Total persons: %d  Total Paid: %d",section3,total3,totalam3);
printf("Section 4: %s  Total persons: %d  Total paid: %d",section4,total4,totalam4);
printf("Section 5: %s Total Persons: %d  Total paid: %d",section5,total5,totalam5);



getch();
}
Related Content