리 데...
문 string더 include 배 char * #1,#2,#3 strcpy를 ,
"empty" PUSH를 , 배 모 변는 ... 를 모르 ..
"empty" PUSH를 , 배 모 변는 ... 를 모르 ..
AnswerMe 를 .#1, #2, #3 를 떻 바는 모르. 리 리 .
~cpp #1 : strcpy(array[i], "empty"); #2 : strcpy(array[0], "empty"); #3 : strcpy(array[tail], "empty");능면, 를 . 대면, 불능 를 말는 . --NeoCoin
문 는 . --문명
밤(10 ) 변리. 는 . 미. , . 변 람들 붙 물보는 방 . 리, , call By Value, call By reference Pointer 부 면 . --NeoCoin
명 복 . 본 --;;
~cpp #include <iostream> #include <string> using namespace std; const int ASIZE = 5; // VC++ 7.0 , 면 디 모 . // VC++ 6.0 면, 마 release 모 . void main() { std::string a; char * array[ASIZE]; // Pointer 배. , 문를 . // char 를 리 는 를 는 32bit 들 Pointer들 5 // 배. // Pointer들 미 는 들 .(러 ) int tail = 0, status = 3; int select, count; for(int i = 0 ; i < ASIZE ; i++) strcpy(array[i], "empty"); // Pointer 르는 부 능 메모리 면 // 덮 . VC++ 6.0 Debug 모는 디 보를 // 변 능 문 러 는 // 보. debug 모는 느 능 // . Release 모 바 보. do { cout << "1. PUSH 2. Pop 3. Stack 4. Queue 5. Show 6. Exit" << endl; cin >> select; switch(select) { case 1 : cout << " : "; if (tail == ASIZE) { cout << " ." << endl; break; } cin >> array[tail]; // array[tail] 미는 메모리 리는 // Pointer. 문를 는 므 // 보 . 능 메모리 면, 받 만 // 덮 . tail++; break; case 2 : if(status == 4) // { strcpy(array[0], "empty"); tail--; for(count = 0 ; count < tail ; count++) array[count] = array[count+1]; // string 리, Pointer 만 복됩. // string 면, call by value class // 복 루 . 는 는 // 문. 배 모 char 리 됩. // 는 바면 모 바. } else // { tail--; strcpy(array[tail], "empty"); // , 미는 대 복 . } break; case 3 : status = 3; break; case 4 : status = 4; break; case 5 : for(count = 0 ; count < tail ; count++) { cout << array[count] << "] "; // , 미는 리는 Pointer를 는 // . , empty+null 는 메모리 // 문, . } cout << endl; break; case 6 : break; default : cout << " 1부 6 를 " << endl; } }while(select != 6); }
명, cin
~cpp std:string
, char* cin string 받는 는
string 배 는 미 .
~cpp C:\Program Files\Microsoft Visual Studio\VC98\Include\istream
. 면, Debug 모 따 보.string 배 는 미 .
~cpp string element; cin >> element>> 는, string 를 보면, 를 . 부 .
~cpp ... 략 ... if (_Ok) // 료? 본 enter, space 료 { // state okay, extract characters ...략... _Str.erase(); // string element _TRY_IO_BEGIN // 리 /// 받 문 내, _Mysizt _Size = 0 < _Istr.width() && (_Mysizt)_Istr.width() < _Str.max_size() ? (_Mysizt)_Istr.width() : _Str.max_size(); ...략... /// 면, 문를 string 더는 for (; 0 < _Size; --_Size, _Meta = _Istr.rdbuf()->snextc()) ...략... _Str.append(1, _Traits::to_char_type(_Meta)); // 문를 더. , string // 메모리를 . ...략...러,
~cpp char* element; cin >> element;는 는 . 동 .
~cpp ...략... *_Str++ = _Traits::to_char_type(_Meta); // _Str char* element . , 문를 는 는 . // , element 리는 는 . // 만 OS 보 램 는 면, // 램 . ...략...
리 떻 는 모르.. 를 만들 ?
리 방, 들 말 따 보면 . 러 많 들 는 보 러 모르. ^^;; 는 링 . --NeoCoin
리 방, 들 말 따 보면 . 러 많 들 는 보 러 모르. ^^;; 는 링 . --NeoCoin
ps. 데블 를 대 ZeroWiki 방 대 부 . 만, .
~cpp #include <iostream> #include <string> using namespace std; const int ASIZE = 5; void main() { string array[ASIZE]; int tail = 0, status = 3; int select, count; for(int i = 0 ; i < ASIZE ; i++) array[i] = "empty"; //#1 do { cout << "1. PUSH 2. Pop 3. Stack 4. Queue 5. Show 6. Exit" << endl; cin >> select; switch(select) { case 1 : cout << " : "; if (tail == ASIZE) { cout << " ." << endl; break; } cin >> array[tail]; tail++; break; case 2 : if(status == 4) // { array[0] = "empty"; //#2 tail--; for(count = 0 ; count < tail ; count++) array[count] = array[count+1]; } else // { tail--; array[tail] = "empty"; //#3 } break; case 3 : status = 3; break; case 4 : status = 4; break; case 5 : for(count = 0 ; count < tail ; count++) { cout << array[count] << "]\t"; } cout << endl; break; case 6 : break; default : cout << " 1부 6 를 " << endl; } }while(select != 6); }