school fee

good day guys..need some help. how to put an error message that says "invalid input,try again?" and "Repeat the program again? yes/no" in my program..


here is my f**king program so far...






#include <iostream>
#include <math.h>
#include <conio.h>
#include <cstdlib>

using namespace std;


int main ()


{

{
char N,O;
char yes,no;
int units,rate,RPU;
float misc,labfee;
float f1,f2,f3,f4,f5,f6,f7;
float f8,f9,f10,f11,f12,f13,f14;

cout<<" ______________________________________________________"<<endl;
cout<<" Mindanao State University "<<endl;
cout<<" Marawi City "<<endl;
cout<<" ______________________________________________________"<<endl;
cout<<" Student's Name : George B. Pakaw "<<endl;
cout<<" Course & Year : BSCS - 1 "<<endl;
cout<<" Specialization : Programming "<<endl;
cout<<" "<<endl;
cout<<" Enrolment Status [N-New/O-Old]",cin>> N,O;cout<<" "<<endl;
{
if (O>N)
{
cout<<" No fees"<<endl;
}
else if (N>O)
{
cout<<"_______________________________________________________"<<endl;
cout<<" NEW STUDENTS "<<endl;
cout<<" MISCELLANEOUS FEES "<<endl;
cout<<" Library :P",cin>>f1;
cout<<" Books :P",cin>>f2;
cout<<" Others :P",cin>>f3;
cout<<" School Improvements :P",cin>>f4;
cout<<" Medical :P",cin>>f5;
cout<<" Dental :P",cin>>f6;
cout<<" Athletic :P",cin>>f7;
cout<<" Cultural :P",cin>>f8;
cout<<" Testing Fee :P",cin>>f9;
cout<<" ID/Passbook :P",cin>>f10;
cout<<" Handbook :P",cin>>f11;
cout<<" SCUAA :P",cin>>f12;
cout<<" COR :P",cin>>f13;
cout<<" Class Card :P",cin>>f14;
cout<<" "<<endl;
}
else;
{
cout<<"Total Miscellaneous :P"<<f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14<<endl;
cout<<"_______________________________________________________"<<endl;
cout<<"Rate Per Unit :P 90 "<<endl;
cout<<"_______________________________________________________"<<endl;
cout<<"Total Number of Units Enrolled : ",cin>>units;
cout<<"With Lab? [yes/no]",cin>>yes,no;
cout<<"Laboratory Fee :P1500 "<<endl;
cout<<"_______________________________________________________"<<endl;
}


if(yes>no)
{
cout<<"George B. Pakaw your TOTAL PAYABLE is "<<(units*90)+f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+1500<<endl;
}
else if(no>yes)
{
cout<<"George B. Pakaw your TOTAL PAYABLE is "<<(units*90)+f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14<<endl;
}
else
{
cout<<" "<<endl;
}



}
cout<<"_______________________________________________________"<<endl;

return 0;
}

}
Last edited on
here is my f**king program so far...
That's a very good way to get help around here. As far as your issue you are going to want a loop. Something like
1
2
3
4
do
{
    //stuff
} while(again == 'y' || again == 'Y');
else;
well, that looks bad.
why don't you use code brackets?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <iostream>
#include <math.h>
#include <conio.h>
#include <cstdlib>

using namespace std;


int main ()


{

{
char N,O;
char yes,no;
int units,rate,RPU;
float misc,labfee;
float f1,f2,f3,f4,f5,f6,f7;
float f8,f9,f10,f11,f12,f13,f14;

cout<<" ______________________________________________________"<<endl;
cout<<" Mindanao State University "<<endl;
cout<<" Marawi City "<<endl;
cout<<" ______________________________________________________"<<endl;
cout<<" Student's Name : George B. Pakaw "<<endl;
cout<<" Course & Year : BSCS - 1 "<<endl;
cout<<" Specialization : Programming "<<endl;
cout<<" "<<endl;
cout<<" Enrolment Status [N-New/O-Old]",cin>> N,O;cout<<" "<<endl;
{
if (O>N)
{
cout<<" No fees"<<endl;
}
else if (N>O)
{
cout<<"_______________________________________________________"<<endl;
cout<<" NEW STUDENTS "<<endl;
cout<<" MISCELLANEOUS FEES "<<endl;
cout<<" Library :P",cin>>f1;
cout<<" Books :P",cin>>f2;
cout<<" Others :P",cin>>f3;
cout<<" School Improvements :P",cin>>f4;
cout<<" Medical :P",cin>>f5;
cout<<" Dental :P",cin>>f6;
cout<<" Athletic :P",cin>>f7;
cout<<" Cultural :P",cin>>f8;
cout<<" Testing Fee :P",cin>>f9;
cout<<" ID/Passbook :P",cin>>f10;
cout<<" Handbook :P",cin>>f11;
cout<<" SCUAA :P",cin>>f12;
cout<<" COR :P",cin>>f13;
cout<<" Class Card :P",cin>>f14;
cout<<" "<<endl;
}
else;
{
cout<<"Total Miscellaneous :P"<<f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14<<endl;
cout<<"_______________________________________________________"<<endl;
cout<<"Rate Per Unit :P 90 "<<endl;
cout<<"_______________________________________________________"<<endl;
cout<<"Total Number of Units Enrolled : ",cin>>units;
cout<<"With Lab? [yes/no]",cin>>yes,no;
cout<<"Laboratory Fee :P1500 "<<endl;
cout<<"_______________________________________________________"<<endl;
}


if(yes>no)
{
cout<<"George B. Pakaw your TOTAL PAYABLE is "<<(units*90)+f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+1500<<endl;
}
else if(no>yes)
{
cout<<"George B. Pakaw your TOTAL PAYABLE is "<<(units*90)+f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14<<endl;
}
else
{
cout<<" "<<endl;
}



}
cout<<"_______________________________________________________"<<endl;

return 0;
}

}

Last edited on
Topic archived. No new replies allowed.