--------<munja.h>----------
<munja.cpp>------------
<munja2.cpp>----------
~cpp class munja{ private: char a[50]; int c; public: munja(); ~munja(); void input(); friend void search(munja); void add(munja,munja); void repeat(munja); };------
~cpp #include "munja.h" void main(){ munja Mun; munja Mun2; Mun.input(); search(Mun); Mun.add(Mun,Mun2); Mun.repeat(Mun); }------
~cpp #include "munja.h" munja::munja(){ c=0; } munja::~munja(){ } void munja::input(){ cout<<"문자열을 입력하시오"<<endl; cin>>a; } void search(munja A){ int i; char b; cout<<"찾을 문자는?"<<endl; cin>>b; for (i=0;i<50;i++){ if (A.a[i]==b){ cout<<"찾은 문자의 위치는 "<<i+1<<"입니다."<<endl; } } } void munja :: add(munja A, munja B){ B.input(); cout<<"추가되어 완성된 문자열은"<<A.a<<B.a<<"입니다"<<endl; } void munja::repeat(munja C){ int k; cout<<"반복할 횟수를 입력하세요"<<endl; cin>>C.c; for (k=0;k<C.c;k++){ cout<<C.a<<endl; } }