- 最後登錄
- 2024-5-16
- 在線時間
- 3609 小時
- 註冊時間
- 2012-1-20
- 閱讀權限
- 20
- 精華
- 0
- UID
- 10797184
- 帖子
- 101
- 積分
- 0 點
- 潛水值
- 32650 米
| 本帖最後由 joke0857 於 2013-8-7 08:40 PM 編輯
我的程式碼:- #include<iostream>#include<fstream>#include<string>using namespace std;int main(){ ifstream fin; fin.open("adress.xml"); string file; while(getline(fin,file)) { cout<<file<<endl; }}
複製代碼
請問接下來要怎麼打?
這是xml檔(測資)的內容:
<?sml version="1.0"?>
<address_book>
<contact>
<name>George Clooney</name>
<street>1042 El Camino Real</street>
<city>Beverly Hills</city>
<state>CA</state>
<zip>90214</zip>
</contact>
<contact>
<name>Cathy Pearl</name>
<street>405 A St.</street>
<city>Palmdale</city>
<state>CA</state>
<zip>93352</zip>
</contact>
<contact>
<name>Paris Hilton</name>
<street>200 S. Elm St.</street>
<city>Beverly Hills</city>
<state>CA</state>
<zip>90212</zip>
</contact>
<contact>
<name>Wendy Jones</name>
<street>982 Boundary Ave.</street>
<city>Palmdale</city>
<state>CA</state>
<zip>93354</zip>
</contact>
</address_book>
... |
|