c++를 이용한 Lotto 고객 관리
- 최초 등록일
- 2012.07.24
- 최종 저작일
- 2009.06
- 15페이지/ MS 파워포인트
- 가격 1,000원
소개글
c++를 이용한 Lotto 고객 관리
목차
없음
본문내용
난수 변수 함수
클래스 이름 - CUSTOMER
고객 정보 받기
void InputCustomer(CUSTOMER* cust, int& maxCustomer, int& numCustomer)
{ if ( numCustomer == maxCustomer )
{
maxCustomer *= 2;
CUSTOMER *temp=new CUSTOMER[maxCustomer];
memcpy(temp, cust, sizeof(CUSTOMER) * numCustomer);
delete[] cust;
cust=temp;
}
cout << "고객이름: ";
cin >> cust[numCustomer].name;
cout << "나이: ";
cin >> cust[numCustomer].age;
cout << "성별(M, F): ";
cin >> cust[numCustomer].sex;
numCustomer++;
}
고객 정보 받기
memcpy
(복사대상메모리, 복사원 메모리, 복사할 길이)
고객 정보 출력
void PrintCustomer(const CUSTOMER *cust, int numCustomer)
{
cout << "--------------------------------\n";
cout << "이름 나이성별\n";
cout << "--------------------------------\n";
for ( int i = 0; i < numCustomer; i++ )
{
cout.width(20);
cout.setf(ios_base::left);
cout << cust[i].name;
cout.width(5);
cout << cust[i].age;
cout << cust[i].sex << "\n";
}
cout << "---------------------------------\n";
}
참고 자료
없음