Anda di halaman 1dari 3

/*

NAME: MOHAMAD AFIZA BIN HAMZAH


MATRIX NO: 2010662498
COURSE CODE: CS110
ASSIGNMENT: Assignment 2, Question 2.3
PROGRAM PURPOSE: Display gift based on treats points
DATE : 21 AUGUST 2010
*/
#include<iostream.h>
void main()
{
char card [20], name [40], code;
float bal, point;
cout << "Enter your card number= " << endl;
cin >> card ;
cout << "Enter your name= " << endl;
cin >> name;
cout << "Enter your treats points= " << endl;
cin >> point;
cout << "A = ST0010" << endl;
cout << "B = ST0009" << endl;
cout << "C = ST0008" << endl;
cout << "D = HST0011" << endl;
cout << "E = HST0012" << endl;
cout << "F = HST0013" << endl;
cout << "Enter gift code= " << endl;
cin >> code ;

switch(code)
{
case 'A' : if (point>=266500)
{
bal = point - 266500;
cout << "\nCustomer card number : " << c
ard << endl;
cout << "Customer name : " << n
ame << endl;
cout << "Treats points : " << p
oint << endl;
cout << "Gift code : ST0010
" << endl;
cout << "Type of gift : Nokia
5230 Nuron" << endl;
cout << "Balance of treats points: " << bal << endl;
}
else
{
cout << "Error" << endl;
}
break;
case 'B' : if (point>=155500)
{
bal = point - 155500;
cout << "\nCustomer card number : " << c
ard << endl;
cout << "Customer name : " << n
ame << endl;
cout << "Treats points : " << p
oint << endl;
cout << "Gift code : ST0009
" << endl;
cout << "Type of gift : Nokia
6210-3G Phone (Navigator)" << endl;
cout << "Balance of treats points: " <<
bal << endl;
}
else
{
cout << "Error" << endl;
}
break;
case 'C' : if (point>=72500)
{
bal = point-72500;
cout << "\nCustomer card number : " << c
ard << endl;
cout << "Customer name : " << n
ame << endl;
cout << "Treats points : " << p
oint << endl;
cout << "Gift code : ST0008
" << endl;
cout << "Type of gift : Nokia
5800 Phone (Xpress Music)" << endl;
cout << "Balance of treats points: " <<
bal << endl;
}
else
{
cout << "Error" << endl;
}
break;
case 'D': if (point>=172000)
{
bal = point-172000;
cout << "\nCustomer card number : " << c
ard << endl;
cout << "Customer name : " << n
ame << endl;
cout << "Treats points : " << p
oint << endl;
cout << "Gift code : HST001
1" << endl;
cout << "Type of gift : Nokia
5230 Nuron" << endl;
cout << "Extra charges : RM680"
<< endl;
cout << "Balance of treats points: " <<
bal << endl;
}
else
{
cout << "Error" << endl;
}
break;
case 'E': if (point>=98000)
{
bal = point-98000;
cout << "\nCustomer card number : " << c
ard << endl;
cout << "Customer name : " << n
ame << endl;
cout << "Treats points : " << p
oint << endl;
cout << "Gift code : HST001
2" << endl;
cout << "Type of gift : Nokia
6210-3G Phone (Navigator)" << endl;
cout << "Extra charges : RM480"
<< endl;
cout << "Balance of treats points: " <<
bal << endl;
}
else
{
cout << "Error" << endl;
}
break;
case 'F': if (point>=44000)
{
bal = point-44000;
cout << "\nCustomer card number : " << c
ard << endl;
cout << "Customer name : " << n
ame << endl;
cout << "Treats points : " << p
oint << endl;
cout << "Gift code : HST001
3" << endl;
cout << "Type of gift : Nokia
5800 Phone (Xpress Music)" << endl;
cout << "Extra charges : RM280"
<< endl;
cout << "Balance of treats points: " <<
bal << endl;
}
else
{
cout << "Error" << endl;
}
break;
default : cout << "Error" << endl;
}

Anda mungkin juga menyukai