📄 page_816.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>page_816</title> <link rel="stylesheet" href="reset.css" type="text/css" media="all"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <table summary="top nav" border="0" width="100%"> <tr> <td align="left" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_815.html">< previous page</a></td> <td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_816</strong></td> <td align="right" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_817.html">next page ></a></td> </tr> <tr> <td align="left" colspan="3" style="background: #ffffff; padding: 20px;"> <table border="0" width="100%" cellpadding="0"><tr><td align="center"> <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td align="left"></td> <td align="right"></td> </tr></table></td></tr><tr><td align="left"><p></p><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td align="right"><font face="Times New Roman, Times, Serif" size="2" color="#FF0000">Page 816</font></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td> <td colspan="3" height="12"></td> <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td> <td><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">void聽OpenForOutput(聽/*聽inout聽*/聽ofstream&聽someFile聽)聽聽聽//聽File聽to聽be<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽//聽opened<br />//聽Prompts聽the聽user聽for聽the聽name聽of聽an聽output聽file<br />//聽and聽attempts聽to聽open聽the聽file<br /><br />//聽Postcondition:<br />//聽聽聽聽聽The聽user聽has聽been聽prompted聽for聽a聽file聽name<br />//聽聽&&聽IF聽the聽file聽could聽not聽be聽opened<br />//聽聽聽聽聽聽聽聽聽An聽error聽message聽has聽been聽printed<br />//聽Note:<br />//聽聽聽聽聽Upon聽return聽from聽this聽function,聽the聽caller聽must聽test<br />//聽聽聽聽聽the聽stream聽state聽to聽see聽if聽the聽file聽was聽successfully聽opened<br /><br />{<br />聽聽聽聽char聽fileName[51];聽聽聽//聽User-specified聽file聽name聽(max.聽50聽chars)<br /><br />聽聽聽聽cout聽<<聽Output聽file聽name:聽;<br />聽聽聽聽cin.get(fileName,聽51);<br />聽聽聽聽cin.ignore(100,聽\n);<br /><br />聽聽聽聽someFile.open(fileName);<br />聽聽聽聽if聽(聽!someFile聽)<br />聽聽聽聽聽聽聽聽cout聽<<聽**聽Can't聽open聽聽<<聽fileName聽<<聽聽**聽<<聽endl;<br />}<br /><br />//******************************************************************<br />void聽GetRecords(聽/*聽inout聽*/聽ifstream&聽inFile,聽聽聽//聽Input聽file<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽/*聽out聽*/聽聽聽PersonRec聽list[]聽)聽聽//聽List聽receiving<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽input聽records<br />//聽Reads聽people's聽records聽from聽inFile<br />//聽and聽stores聽them聽into聽array聽list<br /><br />//聽Precondition:<br />//聽聽聽聽聽inFile聽has聽been聽successfully聽opened聽for聽input<br />//聽聽&&聽inFile聽contains聽at聽least聽one聽record聽and聽at聽most聽MAX_RECS<br />//聽聽聽聽聽records,聽including聽the聽sentinel聽record<br />//聽聽&&聽People's聽last聽names聽and聽first聽names聽are聽at聽most<br />//聽聽聽聽聽15聽characters聽each<br />//聽Postcondition:<br />//聽聽聽聽聽Assuming聽inFile聽contains聽N聽records聽(including聽the<br />//聽聽聽聽聽sentinel聽record),聽list[0..N-1]聽contain聽the聽input聽records<br /><br />{<br />int聽index聽=聽0;聽聽聽//聽Array聽index<br /></font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table></td></tr></table><p><font size="0"></font></p>聽 </td> </tr> <tr> <td align="left" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_815.html">< previous page</a></td> <td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_816</strong></td> <td align="right" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_817.html">next page ></a></td> </tr> </table> </body> </html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -