⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page_733.html

📁 Programming and Problem Solving with C++
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">	<html>		<head>			<title>page_733</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_732.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_733</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_734.html">next page&nbsp;&gt;</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 733</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">const聽int聽NUM_PRECINCTS聽=聽4;<br />const聽int聽NUM_CANDIDATES聽=聽4;<br /><br />typedef聽char聽String10[11];聽聽聽聽聽聽聽聽//聽Room聽for聽10聽characters聽plus聽\0<br />typedef聽int聽VoteTable[NUM_PRECINCTS][NUM_CANDIDATES];<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽//聽2-dimensional聽array聽type<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽for聽votes<br />void聽GetNames(聽String10[]聽);<br />void聽OpenForInput(聽ifstream&amp;聽);<br />void聽OpenForOutput(聽ofstream&amp;聽);<br />void聽WritePerCandidate(聽const聽VoteTable,聽const聽String10[],<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽ofstream&amp;聽);<br />void聽WritePerPrecinct(聽const聽VoteTable,聽ofstream&amp;聽);<br />void聽WriteTable(聽const聽VoteTable,聽const聽String10[],聽ofstream&amp;聽);<br />void聽ZeroVotes(聽VoteTable聽);<br /><br />int聽main()<br />{<br />聽聽聽聽聽VoteTable聽votes;聽聽聽聽聽聽聽聽聽//聽Totals聽for聽precincts聽vs.聽candidates<br /><br />聽聽聽聽聽String10聽聽name[NUM_CANDIDATES];聽聽//聽Array聽of聽candidate聽names<br /><br />聽聽聽聽聽int聽聽聽聽聽聽聽candidate;聽聽聽聽聽//聽Candidate聽number聽input聽from聽voteFile<br />聽聽聽聽聽int聽聽聽聽聽聽聽precinct;聽聽聽聽聽聽//聽Precinct聽number聽input聽from聽voteFile<br />聽聽聽聽聽ifstream聽聽voteFile;聽聽聽聽聽聽//聽Input聽file聽of聽precincts,聽candidates<br />聽聽聽聽聽ofstream聽聽reportFile;聽聽聽聽//聽Output聽file聽receiving聽summaries<br /><br />聽聽聽聽聽OpenForInput(voteFile);<br />聽聽聽聽聽if聽(聽!voteFile聽)<br />聽聽聽聽聽聽聽聽聽return聽1;<br />聽聽聽聽聽OpenForOutput(reportFile);<br />聽聽聽聽聽if聽(聽!reportFile聽)<br />聽聽聽聽聽聽聽聽聽return聽1;<br /><br />聽聽聽聽聽GetNames(name);<br />聽聽聽聽聽ZeroVotes(votes);<br /><br />聽聽聽聽聽//聽Read聽and聽tally聽votes<br /><br />聽聽聽聽聽voteFile聽&gt;&gt;聽precinct聽&gt;&gt;聽candidate;<br />聽聽聽聽聽while聽(voteFile)<br />聽聽聽聽聽{<br />聽聽聽聽聽聽聽聽聽聽聽聽聽//聽Invariant聽(prior聽to聽test):<br />聽聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽聽聽For聽each聽pair聽(precinct,聽candidate)聽of聽input<br />聽聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽聽聽values聽prior聽to聽the聽current聽pair,<br />聽聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽聽聽votes[precinct-1][candidate-1]聽has聽been<br />聽聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽聽聽incremented聽by聽1<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_732.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_733</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_734.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -