Professional Documents
Culture Documents
Lab Excercise 3
Lab Excercise 3
Lab Excercise 3
int main(){
double amt, total;
int assist, payment;
int count = 0;
char ans;
string fname;
ifstream in_file;
ofstream out_file;
4. while (in_file>>amt>>assist>>payment){
total = 0;
out_file<< "Customer " << ++count << ": " << endl;
5. if (assist == 0)
total = amt;
else {
if (amt < 50)
total = amt + 0.50;
6. else
total = amt;
}
if (payment == 1)
total = total + 0.05 * total;
7. out_file<< "=======================================\n";
out_file<< "TOTAL charge ==> RM " << fixed << setprecision(2)<<total<<"\n";
out_file<< "=======================================\n\n";
}
8. cout<<"Bill ready";
return 0;
}
1
2 4
8
1. int main() {
int numbers[20];
int index = 0;
int duplicate;
int value; // number entered by user
4 5