won't stop looping for the second registration and max min aren't working

Write your question here.

#include<iostream>
#include<cstring>
#include<iomanip>

using namespace std;

int main()
{
char studentName[50];
char schoolName[30];
char category[10];
char codeOfPackage[10];
char codeOfTime;
char codeOfIndividualSub[10];
char codeOfCategory;
char registration = 'Y', choicesub = 'Y', addOn = 'Y', anotherPackage = 'Y';
char BMY, ENG, SEJ, MAT, SCI, GEO, BIO, CHE, PHY, ADD, ACC, ECO, MMA;
char type;
int contactNumber, PT3 = 0, SPM = 0, n, PTL = 0, PTA = 0, SPS = 0, SPA = 0, SPE = 0, PT3Sub = 0, SPMSub = 0, count=1, user=1, max_amount=0, min_amount=10000000;
float tax, price = 0, pricePerSubject, TpricePT3=0, TpriceSPM=0, TpricePT1 =0, TpricePT2 =0, TpriceSPM1 =0, TpriceSPM2 =0, TpriceSPM3 =0, TpricePT4 =0, TpricePT5 =0;
float price1 = 0, price2 = 0 , price3 = 0, price4 = 0, price5 = 0, price6 = 0, price7 = 0, price8 = 0, price9 = 0, price10 = 0;
float price11 = 0, price12 = 0, price13 = 0, price14 = 0, price15 = 0, price16 = 0, price17 =0, price18 =0, price19 =0, price20 =0,price21 =0, price22 =0;
float price23 = 0, price24 = 0, price25 = 0, price26 = 0, price27 = 0, price28 = 0, price29 =0, price30 =0, price31 =0, price32 =0;

do
{
cout<<"\n========================================================================";
cout<<"\n\n Welcome to i-Excellent Tuition Academy "<<endl;
cout<<"\n========================================================================";

cout<<"\nThis is a registration form." <<endl;

cout<<"\nPlease enter your full name : " ;
cin>>ws;
cin.getline(studentName,50);
cout<<"\nPlease enter your school name : ";
cin.getline(schoolName,30);
cout<<"\nPlease enter your contact number : ";
cin>>contactNumber;
cout<<"\nPlease enter category ( PT3 / SPM ) : ";
cin>>category;


the continuaition of program is on the comment section
Last edited on
if (strcmp(category ,"PT3")==0 || strcmp(category ,"pt3")==0)
{
cout<<"\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|";
cout<<"\n| Category | Type of | Code of | Type of | Code of | Code of Individual | Subject | Time | Code of | Price per| Price per | |";
cout<<"\n| | Category | Category | Subject | Package | Subject | | | Time | package | individual | Tax |";
cout<<"\n|-------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|";
cout<<"\n| | | | LANGUAGE | PTL | BMY | Bahasa Melayu | Weekdays | D | 90 | 35 | |";
cout<<"\n| | | | | | ENG | English | Weekend | E | 70 | 35 | |";
cout<<"\n| | PACKAGE | P | | | SEJ | Sejarah | | | | 35 | |";
cout<<"\n| PT3 | / | / =======================================================================================================|============| 6 % |";
cout<<"\n| | INDIVIDUAL | I | STEM | PTA | MAT | Mathematics | Weekdays | D | 80 | 30 | |";
cout<<"\n| | | | | | SCI | Science | Weekend | E | 70 | 30 | |";
cout<<"\n| | | | | | GEO | Geography | | | | 30 | |";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------|------------|-------|";

cout<<"\n\nPlease enter your type of category (P-Package / I-Individual) : ";
cin>>codeOfCategory;

if (codeOfCategory == 'P' || codeOfCategory == 'p')
{
cout<<"\n|-------------------------------------------------------------------------------------------------------------------------------------------------|";
cout<<"\n| Category | Type of | Code of | Type of | Code of | Code of Individual | Subject | Time | Code of | Price per |";
cout<<"\n| | Category | Category | Subject | Package | Subject | | | Time | package |";
cout<<"\n|-------------------------------------------------------------------------------------------------------------------------------------------------|";
cout<<"\n| | | | LANGUAGE | PTL | BMY | Bahasa Melayu | Weekdays | D | 90 |";
cout<<"\n| | | | | | ENG | English | Weekend | E | 70 |";
cout<<"\n| | | | | | SEJ | Sejarah | | | |";
cout<<"\n| PT3 | PACKAGE | P =======================================================================================================|";
cout<<"\n| | | | STEM | PTA | MAT | Mathematic | Weekdays | D | 80 |";
cout<<"\n| | | | | | SCI | Science | Weekend | E | 70 |";
cout<<"\n| | | | | | GEO | Geography | | | |";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------|";

cout<<"\nPlease enter code of Package ( PTL-Language / PTA-STEM ) : ";
cin>>codeOfPackage;

if(strcmp(codeOfPackage,"PTL")==0 || strcmp(codeOfPackage,"ptl")==0)
{
cout<<"\nPlease enter code of time ( D-WEEKDAYS / E-WEEKEND ) : ";
cin>>codeOfTime;

if (codeOfTime == 'D' || codeOfTime =='d')
{
price=90.00;
}
else if (codeOfTime == 'E' || codeOfTime == 'e')
{
price=70.00;
}
else
{
price=0.00;
cout<<"\nERROR!";
}
//tax = 0.06;
TpricePT1 = price; //+ (price * tax);
}
else if(strcmp(codeOfPackage,"PTA")==0 || strcmp(codeOfPackage,"pta")==0)
{

cout<<"\nPlease enter code of time ( D-WEEKDAYS / E-WEEKEND ) : ";
cin>>codeOfTime;

if(codeOfTime == 'D' || codeOfTime =='d')
{
price=80.00;
}
else if(codeOfTime =='E' || codeOfTime =='e')
{
price=70.00;
}
else
{
price = 0.00;
}
//tax = 0.06;
TpricePT2 = price; //+ (price * tax);
}
else
{
price=0.00;
cout<<"\nERROR!";
}
cout<<"\nDo you want to add Individual Subject? : ";
cin>>addOn;
cout<<setprecision(2)<<fixed;


if (addOn == 'Y')
{
for (int PT3Sub =0; PT3Sub <4; PT3Sub++)
{
cout<<"\n|-------------------------------------------------------------------------------------|";
cout<<"\n| Category | Code of Individual | Subject | Time | Code of | Price per |";
cout<<"\n| | Subject | | | Time | subject |";
cout<<"\n|-------------------------------------------------------------------------------------|";
cout<<"\n| | BMY | Bahasa Melayu | | | 35 |";
cout<<"\n| |--------------------|-----------------| | |-----------|";
cout<<"\n| | ENG | English | | | 35 |";
cout<<"\n| |--------------------|-----------------| | |-----------|";
cout<<"\n| | SEJ | Sejarah | Weekdays | D | 35 |";
cout<<"\n| |--------------------|-----------------| | |-----------|";
cout<<"\n| PT3 | MAT | Mathematics | Weekend | E | 30 |";
cout<<"\n| |--------------------|-----------------| | |-----------|";
cout<<"\n| | SCI | Science | | | 30 |";
cout<<"\n| |--------------------|-----------------| | |-----------|";
cout<<"\n| | GEO | Geography | | | 30 |";
cout<<"\n--------------------------------------------------------------------------------------|";

cout<<"\nHow many subject do you want to register (MAXIMUM - 4 SUBJECTS)? : ";
cin>>PT3Sub;

while (PT3Sub<0 || PT3Sub>4)
{
cout<<"ERROR!!";
cout<<"\nHow many subject do you want to register (MAXIMUM - 4 SUBJECTS)? : "; //over limit please choose until 4 subject
cin>>PT3Sub; //cin>>countI;
}

while(count<= PT3Sub)
{

cout<<"\n\nPlease enter code of Individual Subject : ";
cin>>codeOfIndividualSub;

while(strcmp(codeOfIndividualSub,"BMY")!=0 && strcmp(codeOfIndividualSub,"ENG")!=0 && strcmp(codeOfIndividualSub,"SEJ")!=0 && strcmp(codeOfIndividualSub,"MAT")!=0 && strcmp(codeOfIndividualSub,"SCI")!=0 && strcmp(codeOfIndividualSub,"GEO")!=0)
{
cout<<"ERROR!!";
cout<<"\n\nPlease enter code of Individual Subject : ";
cin>>codeOfIndividualSub;

}

if (strcmp(codeOfIndividualSub,"BMY")==0)
{
price17 = 35.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Bahasa Melayu : RM" <<price17; //inside

}
else if (strcmp(codeOfIndividualSub,"ENG")==0)
{
price18 = 35.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for English : RM" <<price18; //inside

}
else if (strcmp(codeOfIndividualSub,"SEJ")==0)
{
price19 = 35.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Sejarah : RM" <<price19; //inside

}
else if (strcmp(codeOfIndividualSub,"MAT")==0)
{
price20 = 30.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Mathematics : RM" <<price20; //inside

}
else if (strcmp(codeOfIndividualSub,"SCI")==0)
{
price21 = 30.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Science : RM" <<price21; //inside

}
else if (strcmp(codeOfIndividualSub,"GEO")==0)
{
price22 = 30.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Geography : RM" <<price22; //inside

}
else
{
price = 0.00;
cout<<"\nERROR!!";
}
count++;
//cout<<"\nTotal price for taken subject(s) : RM" <<TpricePT3; //outside price

}
//TpricePT3 = (TpricePT1 + TpricePT2 + price17 + price18 + price19 + price20 + price21 + price22)*tax;
cout<<setprecision(2)<<fixed;


//PT3Sub++;
}
//cout<<"\n\nDo you want to add another registration? (Y-YES / N-NO) : ";
//cin>>registration ;
}
}
else if (codeOfCategory == 'I' || codeOfCategory == 'i')
{
cout<<"\n|--------------------------------------------------------------------------------------------------------------------|";
cout<<"\n| Category | Type of | Code of | Code of Individual | Subject | Time | Code of | Price per |";
cout<<"\n| | Category | Category | Subject | | | Time | subject |";
cout<<"\n|--------------------------------------------------------------------------------------------------------------------|";
cout<<"\n| | | | BMY | Bahasa Melayu | | | 35 |";
cout<<"\n| | | |--------------------|-----------------| | |-----------|";
cout<<"\n| | | | ENG | English | | | 35 |";
cout<<"\n| | | |--------------------|-----------------| | |-----------|";
cout<<"\n| | | | SEJ | Sejarah | Weekdays | D | 35 |";
cout<<"\n| | | |--------------------|-----------------| | |-----------|";
cout<<"\n| PT3 | INDIVIDUAL | I | MAT | Mathematics | Weekend | E | 30 |";
cout<<"\n| | | |--------------------|-----------------| | |-----------|";
cout<<"\n| | | | SCI | Science | | | 30 |";
cout<<"\n| | | |--------------------|-----------------| | |-----------|";
cout<<"\n| | | | GEO | Geography | | | 30 |";
cout<<"\n---------------------------------------------------------------------------------------------------------------------|";

cout<<"\nPlease enter code Of Time (D-WEEKDAYS / E-WEEKEND) : ";
cin>>codeOfTime;
cout<<"\nHow many subject do you want to register (MAXIMUM - 4 SUBJECTS)? : ";
cin>>PT3Sub;

while (PT3Sub<0 || PT3Sub>4)
{
cout<<"ERROR!!";
cout<<"\nHow many subject do you want to register (MAXIMUM - 4 SUBJECTS)? : "; //over limit please choose until 4 subject
cin>>PT3Sub; //cin>>countI;
}

while(count<= PT3Sub)
{

cout<<"\n\nPlease enter code of Individual Subject : ";
cin>>codeOfIndividualSub;

while(strcmp(codeOfIndividualSub,"BMY")!=0 && strcmp(codeOfIndividualSub,"ENG")!=0 && strcmp(codeOfIndividualSub,"SEJ")!=0 && strcmp(codeOfIndividualSub,"MAT")!=0 && strcmp(codeOfIndividualSub,"SCI")!=0 && strcmp(codeOfIndividualSub,"GEO")!=0)
{
cout<<"ERROR!!";
cout<<"\n\nPlease enter code of Individual Subject : ";
cin>>codeOfIndividualSub;

}
if (strcmp(codeOfIndividualSub,"BMY")==0)
{
price1 = 35.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Bahasa Melayu : RM" <<price1; //inside

}
else if (strcmp(codeOfIndividualSub,"ENG")==0)
{
price2 = 35.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for English : RM" <<price2; //inside


}
else if (strcmp(codeOfIndividualSub,"SEJ")==0)
{
price3 = 35.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Sejarah : RM" <<price3; //inside


}
else if (strcmp(codeOfIndividualSub,"MAT")==0)
{
price4 = 30.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Mathematics : RM" <<price4; //inside


}
else if (strcmp(codeOfIndividualSub,"SCI")==0)
{
price5 = 30.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Science : RM" <<price5; //inside


}
else if (strcmp(codeOfIndividualSub,"GEO")==0)
{
price6 = 30.00;
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Geography : RM" <<price6; //inside

}
else
{
price = 0.00;
tax= 0.06;
price = price + (price*tax);
cout<<"\nERROR!!";
}

//TpricePT3 = price1 + price2 + price3 + price4 + price5 + price6;
cout<<setprecision(2)<<fixed;
count++;
//cout<<"\nTotal price for taken subject(s) : RM" <<TpricePT3; //outside price

}


} //else if (individual)
if (TpricePT3 > max_amount)
{
max_amount = TpricePT3;
}
else if (TpricePT3 < max_amount)
{
max_amount = max_amount;
}

if ( TpricePT3 > min_amount)
{
min_amount = min_amount;
}
else if (TpricePT3 < min_amount)
{
min_amount = TpricePT3;
}

tax=0.06;
TpricePT3 = (TpricePT1 + TpricePT2 + TpricePT4 + TpricePT5 + price1 + price2 + price3 + price4 + price5 + price6 + price17 + price18 + price19 + price20 + price21 + price22)*tax + TpricePT1 + TpricePT2 + TpricePT4 + TpricePT5 + price1 + price2 + price3 + price4 + price5 + price6 + price17 + price18 + price19 + price20 + price21 + price22;
cout<<"\n\n *---------RECEIPT OF REGISTRATION FORM-----------*";
cout<<"\n *Your code of category (P-Package / I-Individual) : " <<codeOfCategory <<"*";
cout<<"\n *Your total price for taken subject(s) : RM"<<TpricePT3;
cout<<"\n *------------------------------------------------*";
cout<<"\n *Total user :"<<user;
cout<<"\n *Maximum total price: RM" <<max_amount;
cout<<"\n *Minimum total price: RM" <<min_amount;

cout<<"\n\nDo you want to add another registration? (Y-YES / N-NO) : ";
cin>>registration ;
}
else
{
cout<<"Error!";
}

user++;

while(registration=='Y');

return 0;
}

or is there anyone that is willing to help me out through email? I really need some help on this, thank you :)
Topic archived. No new replies allowed.