?? 4d2.cpp
字號:
/*
NIIT 《C++ & CGI PROGRAMMING &SCRRIPTING》 Skill Base
P4.17 ◆4.D.2◆
Checkup: MrZhou
*/
#include <iostream.h>
class Customer
{
private:
char mobileNo[11];
char name[25];
char dateOfBirth[9];
char billingAddress[51];
char city[25];
char phoneNo[11];
float amountOutstanding;
public:
Customer() //Constructor
{
*mobileNo = '\0';
*name = '\0';
*dateOfBirth = '\0';
*billingAddress = '\0';
*city = '\0';
*phoneNo = '\0';
amountOutstanding = 0.0f;
}
~Customer() //Destructor
{
*mobileNo = '\0';
*name = '\0';
*dateOfBirth = '\0';
*billingAddress = '\0';
*city = '\0';
*phoneNo = '\0';
amountOutstanding = 0.0f;
}
void print()
{
cout << endl << "Mobile phone number: ";
cout << mobileNo << endl;
cout << "Name: ";
cout << name << endl;
cout << "Date of Birth: ";
cout << dateOfBirth << endl;
cout <<"Customer's billing address: ";
cout << billingAddress << endl;
cout << "City: ";
cout << city << endl;
cout << "Residence phone number: ";
cout << phoneNo << endl;
cout << "Amount due: ";
cout << amountOutstanding << endl;
}
void get()
{
cout << "Mobile phone number: ";
cin >> mobileNo;
cin.ignore();
cout << endl << "Name: ";
cin.getline(name, 25);
cout << endl << "Date of Birth: ";
cin >> dateOfBirth;
cin.ignore();
cout << endl << "Customer's billing address: ";
cin.getline(billingAddress, 51);
cout << endl << "City: ";
cin.getline(city, 25);
cout << endl << "Residence phone number: ";
cin >> phoneNo;
cout << endl << "Amount due: ";
cin >> amountOutstanding;
}
};
int main()
{
Customer object;
object.print();
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -