Technote/Data Structure C++42 [C++] 함수가 존재하는 구조체의 변수 #include using std::cout; using std::endl; struct Account{ char accID[20]; char secID[20]; char name[20]; int balance; void Deposit(int money){ balance+=money; } void Withdraw(int money){ balance-=money; } }; int main(void) { Account yoon={"1234","2321","yoon",1000}; yoon.Deposit(100); cout 2009. 9. 18. [C++] 함수까지 구조체로 하나로 묶기 #include using std::cout; using std::endl; struct Account{ char accID[20]; char secID[20]; char name[20]; int balance; }; void Deposit(Account & acc,int money) { acc.balance+=money; } void Withdraw(Account &acc,int money) { acc.balance-=money; } int main(void) { Account yoon = {"1234","2321","yoon",1000}; Deposit(yoon,100); cout 2009. 9. 17. [C++] 구조체 #include using std::cout; using std::endl; struct Account { char accID[20]; char secID[20]; char name[20]; int balance; }; int main(void) { Account yoon={"1234","2321","yoon",1000}; cout 2009. 9. 17. [C++] 동적 메모리 할당에서 메모리 관리 #include #define DEBUG 1 //#define DEBUG 0 using std::cin; using std::cout; using std::endl; int main(void) { int size; cout size; int* arr=new int[size]; #if DEBUG==1 cout 2009. 9. 17. 이전 1 2 3 4 5 6 7 ··· 11 다음