Once we hve entered Y for individual subject and the amount of subject, the receipt wont come out and loop for one more time(how many subject to regiter) before showing the receipt
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 category ( PT3 ) : ";
cin>>category;
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 | Weekend | E | 35 |";
cout<<"\n| |--------------------|-----------------| | |-----------|";
cout<<"\n| | SEJ | Sejarah | Weekdays | D | 35 |";
cout<<"\n--------------------------------------------------------------------------------------|";
cout<<"\nHow many subject do you want to register (MAXIMUM - 3 SUBJECTS)? : ";
cin>>PT3Sub;
while (PT3Sub<0 || PT3Sub>4)
{
cout<<"ERROR!!";
cout<<"\nHow many subject do you want to register (MAXIMUM - 3 SUBJECTS)? : "; //over limit please choose until 3 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 )
{
cout<<"ERROR!!";
cout<<"\n\nPlease enter code of Individual Subject : ";
cin>>codeOfIndividualSub;
}
if (strcmp(codeOfIndividualSub,"BMY")==0)
{
price17 = 35.00;
tax= 0.06;
price17 = price17 + (price17*tax);
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Bahasa Melayu : RM" <<price17; //inside
}
else if (strcmp(codeOfIndividualSub,"ENG")==0)
{
price18 = 35.00;
tax= 0.06;
price18 = price18 + (price18*tax);
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for English : RM" <<price18; //inside
}
else if (strcmp(codeOfIndividualSub,"SEJ")==0)
{
price19 = 35.00;
tax= 0.06;
price19 = price19 + (price19*tax);
cout<<setprecision(2)<<fixed;
cout<<"\nPrice for Sejarah : RM" <<price19; //inside
How can a variable be equal to “BMY”, “ENG”, “SEJ” at the same time?
What about std::strings? Can’t you use them?
Anyway the biggest problem is the fact you don’t need all those nested ifs.
For example: you don’t need to ask the user how many individual ‘subjects’ s/he wants to take (I think you meant ‘courses’, didn’t you?).
Just ask him/her which one s/he want to take and make the additions.
Do calculate the tax only once at the end.
If you split your code into functions, you could easily spot every problem.
Your code is incomplete. You have not shown the definition of your variables. We're not mind readers. How do we know you have your variables defined correctly?
When posting code, please post something that compiles.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
As Enoizat said, break your code into to functions. It will make you code mush easier to follow and debug.