谁能给我一个400行左右的程序,什么的都可以 30

没忘了概述我这是关于什么的程序... 没忘了概述我这是关于什么的程序 展开
 我来答
西班同学
2006-06-20 · TA获得超过165个赞
知道答主
回答量:383
采纳率:0%
帮助的人:0
展开全部
<!--STATUS OK-->
<html><head><title>百度贴吧_c++吧 </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.*{font-family: 宋体;}
a:link {color:#261cdc;text-decoration: underline}
a:visited {color: #261cdc; text-decoration: underline}
a.t:link{color:#261cdc;text-decoration: underline}a.t:hover{color:#261cdc;text-decoration: underline}a.t:visited{color:#800080;text-decoration: underline}
td{font-size:12px; line-height:18px;}
.pb{font-weight:bold;}
.pad10L {PADDING-LEFT: 10px; }
.BG{background-color:#EEEEEE;}
.BG2{ background-color: #EEEEEE;}
.tbPad10{padding-top:6px;padding-bottom:6px;}
.red{color:#FF0000;}
.fB{ font-weight:bold;}
.htb{margin-bottom:5px;font-family:arial}
.htb td{font-family:arial}
.pad10L{padding-left:10px; }.g{color:#666666}
.bt{ background-color:#FCE6CD;clear:both ; height:60px; border:0; width:100%; margin:0; padding:0}
.i{font-size:16px; font-family:arial}
.Tit1{height:21px; font-size:14px; font-family:arial}
a.top{font-family:arial}
a.top:link {COLOR: #0000cc; text-decoration: underline}
a.top:visited {COLOR: #800080; text-decoration: underline}
a.top:active {COLOR: #0000cc; text-decoration: underline}
.c{color:#7777CC;}a.c{color:#7777CC;}a.c:visited{color:#7777CC;}
.ntb{width:100%;background-color:#0000cc;height:20px;line-height:20px;}
.pg{font-size:14px;word-spacing:4px;font-family:arial;width:80%;text-align:center;height:30px;line-height:30px;}
.pg *{font-family:arial}
.pg font{font-size:16px;}
.d{padding-left:10px;}
.s{font-size:14px;table-layout:fixed; word-break :break-all;padding-left:10px;}
.u{table-layout:fixed;word-break :break-all;padding-left:10px;}
-->
</style>
</head>
<script>
document.domain = "baidu.com";

function f_escape(str){
str=escape(str);
return str;
}

function gowhere(formname)
{
var url;
if (formname.myselectvalue.value == "1")
{
url = "/f";
if(formname.word.value=="" || formname.word.value==null){
formname.tn.value = "baiduKeywordSearch";
formname.ct.value = "318767104";
formname.kw.value = "";
formname.rn.value = "50";
formname.lm.value = "0";
formname.pn.value = "0";
}
else {
formname.tn.value = "";
formname.ct.value = "";

formname.rn.value = "";
formname.lm.value = "";
formname.pn.value = "";

formname.kw.value=formname.word.value
}

}
if (formname.myselectvalue.value == "0")
{
url = "/f";
formname.tn.value = "baiduPostSearch";
formname.ct.value = "352321536";
formname.lm.value = "65536";
formname.rn.value = "10";

formname.kw.value="";

}
if (formname.myselectvalue.value == "2")
{
url = "/f";
formname.tn.value = "baiduPostSearch";
formname.ct.value = "352321536";
formname.lm.value = "65541";
formname.rn.value = "10";

formname.kw.value="";

}

formname.action = url;
return true;
}
</script>
<script>
<!--
var need_verify=10;
yzm_str='验证码:   <INPUT name=word1 size=10 maxlength=4>请输入下图中的四位验证码,字母不区分大小写<br><span style="padding-left:60px;"><img id=y_img src="/cgi-bin/genimg?7F4D7942B62A5BCB029D1908EB8CA878A8EC7378FBFE5942605077264D9086F22DA937D05ACCF4279C968F92AEDE845F10352C3970C0" align="middle">  <span style="vertical-align:bottom;"><a href="javascript:check_img()">看不清?</a></span></span>';
var img_str="/cgi-bin/genimg?7F4D7942B62A5BCB029D1908EB8CA878A8EC7378FBFE5942605077264D9086F22DA937D05ACCF4279C968F92AEDE845F10352C3970C0";

function check_img(){
var o_img = document.getElementById('y_img');
o_img.src=img_str +"&t="+ Math.random();
document.post.word1.value="";
}

function f_click(obj1,obj2){
document.post.rs1.value ="";
if(obj1.checked ==true){
obj2.checked = false;
}
else{
obj2.checked=true;
}

if (document.post.rs1.checked == true) {
document.post.rs1.value = 1;
document.getElementById('yzm').innerHTML=yzm_str;
}
else{
if(need_verify==10){
document.getElementById('yzm').innerHTML=yzm_str;
}else{
document.getElementById('yzm').innerHTML='';
}
}
}

function f_trim(inputString) {
if (typeof inputString != 'string') { return inputString; }
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == ' ' || ch == '\r' || ch == '\n') {
retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == ' ' || ch == '\r' || ch == '\n') {
retValue = retValue.substring(0, retValue.length-1);
ch = retValue.substring(retValue.length-1, retValue.length);
}
while (retValue.indexOf(' ') != -1) {
retValue = retValue.substring(0, retValue.indexOf(' ')) +
retValue.substring(retValue.indexOf(' ')+1, retValue.length);
}
return retValue;
}
function h(obj,url){
obj.style.behavior='url(#default#homepage)';
obj.setHomePage(url);
}

function getLeftChars(varField,limit_len) {
var i = 0;
var counter = 0;
var cap = limit_len;
var j=0;
for (i = 0; i< varField.value.length; i++) {
if (varField.value.charCodeAt(i) > 127 || varField.value.charCodeAt(i) == 94) {
j=j+2;
}
else {
j=j+1
}
} //结束FOR循环
//var leftchars = cap - varField.value.length;
var leftchars = cap - j;
return (leftchars);
}

function onCharsChange(varField,a_str,a_limit) {
var leftChars = getLeftChars(varField,a_limit);
if ( leftChars >= 0) {
return true;
} else {
ls_str = a_str + "超过字数限制!";
window.alert(ls_str);
//var len = document.thform.ti.value.length + leftChars;
//document.login.message.value = document.login.ti.value.substring(0, len);
varField.value=""
return false;
}
}

function textCount(obj,a_limit){
if (obj.value.length > a_limit) {
obj.value = obj.value.substring(0,a_limit);
}

}

function f_initi() {

if(11!=4){
if(need_verify==10){
if(document.post.ti.value!="" ){
document.getElementById('yzm').innerHTML=yzm_str;
}
}
}

}

function ga(o,e){
if (document.getElementById){a=o.id.substring(1); p = "";r = "";g = e.target;if (g) { t = g.id;f = g.parentNode;if (f) {p = f.id;h = f.parentNode;if (h) r = h.id;}} else{h = e.srcElement;f = h.parentNode;if (f) p = f.id;t = h.id;}if (t==a || p==a || r==a) return true;window.open(document.getElementById(a).href,'_blank')}
}

function f_submit(){

if(document.post.ti.value == '' || document.post.ti.value == null){
alert("标题不能为空,请输入标题");
return false;

}

if(need_verify==10){
if(document.getElementById('yzm').innerHTML!=null || document.getElementById('yzm').innerHTML!=''){
if(document.post.word1.value == '' || document.post.word1.value == null)
{
alert("验证码不能为空,请输入验证码");
return false;
}
}
}

document.post.ti.value=f_trim(document.post.ti.value);
document.post.str2.value = fr_as_js_tr();
return true;
}

function f_focus(){

if(need_verify==10){
if(document.getElementById('yzm').innerHTML==null || document.getElementById('yzm').innerHTML==''){
document.getElementById('yzm').innerHTML=yzm_str;
}
}

}

function showIK() {
if (typeof(s)!= 'undefined') {
if (!s || s.length < 1) return;
document.getElementById('DivIK').innerHTML = s;
}
}

function showMsg() {
if (typeof(bnw)!= 'undefined') {
if (!bnw || bnw.length < 1) return;
document.getElementById('DivMsg').innerHTML = bnw;
}
}

b=escape(location.href); //用于res页面的删除主题链接bu参数

function fr_as_js_tr(){ var v = 172;for(var i=0;i<40;i++){v += 13;;v=Math.abs(v);v=Math.floor(v);} return v;}

function c(n){
if ((n%2)==1){
document.write('<tr valign=middle bgcolor="#FFFFFF" height=28 align=left>');
}
else {document.write('<tr valign=middle bgcolor="#eeeeee" height=28 align=left>');}

}
-->
</script>
<body text=#000000 bgcolor=#ffffff topmargin=6 bottommargin=0 leftmargin=0 rightmargin=0 onload="f_initi()">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="htb">
<form name=f1 onsubmit="return gowhere(this)" action=/f>
<input type=hidden name=ct value=352321536>
<input type=hidden name=tn value=baiduPostSearch>
<input type=hidden name=rn value=10>
<input type=hidden name=pn value=0>
<input type=hidden name=lm value=65536>
<input type=hidden name=sc value="">
<input type=hidden name=kw value="">
<input type=hidden name=rs2 value="0">
<input name=myselectvalue type=hidden value=1>
<tr valign=middle>
<td width="100%" valign="top" style="padding-left:8px;width:137px;" nowrap>
<a href="/"><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/post-jg.gif" border="0" width="137" height="46" alt="到百度贴吧首页"></a>
</td><td style="font-family:arial">   </td>
<td width="100%" valign="top">
<div class="Tit1">
<a href="http://news.baidu.com/ns?cl=2&rn=20&tn=news&word=c%2B%2B&t=5" class="top">新闻</a>   <a class="top" href="http://www.baidu.com/s?cl=3&wd=c%2B%2B&t=5">网页</a>   <span class="fB">贴吧</span>   <a class="top" href="http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=c%2B%2B&fr=post">知道</a>   <a class="top" href="http://mp3.baidu.com/m?tn=baidump3&ct=134217728&lm=-1&word=c%2B%2B&t=5">MP3</a>   <a class="top" href="http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&word=c%2B%2B&t=5">图片</a>   <a class="top" href="http://baike.baidu.com/w?ct=17&lm=0&tn=baiduWikiSearch&pn=0&rn=10&word=c%2B%2B&submit=search">百科</a>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td valign="top" nowrap>
<input class="i" maxlength=256 size=35 value="c++" name=word> <input name="submit" type=submit value=百度搜索>   </td>
<td nowrap>

<script language="javascript">
login_str="http://passport.baidu.com/?login&tpl=tb&u="+escape(window.location.href)+"&aid=6";
res_str="http://passport.baidu.com/?reg&tpl=tb&u="+escape(window.location.href)+"&aid=6";
lo_str="http://passport.baidu.com/?logout&aid=6&sid=&u="+escape(window.location.href);
document.write("<a href=\""+login_str+"\" target=_top>");
</script>登录</a> |
<script language="JavaScript">
document.write("<a href=\""+res_str+"\" target=_blank>");
</script>注册</a> |
<a href="/f?ct=486539264&cm=58565&tn=bdAdvSearch&word=c%2B%2B">吧内搜索</a> |

<a href="http://www.baidu.com/search/post.html" target=_blank>帮助</a></td>
</tr></table>
<label for="jointb">
<input type="radio" name="tb" checked onclick="document.f1.myselectvalue.value=1;document.f1.rs2.value=0" id="jointb">进入贴吧
</label>
<label for="searchtb">
<input type="radio" name="tb" onclick="document.f1.myselectvalue.value=0;document.f1.rs2.value=1" id="searchtb">帖子搜索
</label>
<label for="authortb">
<input type="radio" name="tb" onclick="document.f1.myselectvalue.value=2;document.f1.rs2.value=2" id="authortb">按作者搜索
</label>
</td>
</tr></form></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="TopMgn6">
<tr>
<td nowrap> <a href="/" >百度贴吧</a> >
<a href="/f?ct=318767104&tn=bdSecondClassIndex&rs1=6&lm=29&word=%C8%ED%BC%FE%D3%EB%B1%E0%B3%CC&pn=0&rn=500">软件与编程</a> >
<a href="/f?kw=c%2B%2B" >c++吧</a> >
<script>
if(11 != 4) {document.write('主题列表');}else {document.write('精品区');}
</script>
</td>
<td align="right" nowrap>吧主:<a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=%BF%E0%D3%DA%B1%E0%B3%CC">苦于编程<a>   </td>
</tr>
</table>
<table border="0" align="center" cellpadding="0" cellspacing="0" class="ntb">
<tr>
<td nowrap>

 <a href="/f?ct=318898176&tn=baiduKeywordSearch&sc=20975&pn=0&rn=50&lm=4&word=c%2B%2B" ><font color="#FFFFFF">精品区</font></a><font color="#FFFFFF">|</font> <a href="http://ntb.baidu.com/f?kw=c%2B%2B"><font color="#FFFFFF">按相关性排序</font></a> <font color="#FFFFFF">|</font> <a href="#sub"><font color="#FFFFFF">发表新留言</font></a>

</td>
<td align="right" nowrap>
<a href="/f?ct=536870912&sc=6&lm=21&tn=bdNotice&word=c%2B%2B" target=_blank><font color="#FFFFFF">贴吧公告</font></a> <font color="#FFFFFF">|</font>

<a href="/f?ct=486539264&cm=58564&tn=baiduAppliAdmin&rs1=20975&word=c%2B%2B&un=" target=_blank><font color="#FFFFFF">申请吧主</font></a> <font color="#FFFFFF">|</font>

<a href="/f?ct=318767104&lm=11&rn=50&tn=baiduKeywordSearch&word=%CC%F9%B0%C9%CD%B6%CB%DF&cm=58820&word1=c%2B%2B#ju" target=_blank><font color="#FFFFFF">贴吧投诉</font></a> 
</td>
</tr>
</table>

<table width="140" border="0" cellpadding="0" cellspacing="0" style="clear:none;padding-right:5px;" align="right" >
<tr>
<td>

<br>
<div class="pad10L" style="word-break: break-all; word-wrap: break-word;">如果您想有更多的贴吧功能,
<script>
login_str="http://passport.baidu.com/?login&tpl=tb&u="+escape(window.location.href)+"&aid=6";
res_str="http://passport.baidu.com/?reg&tpl=tb&u="+escape(window.location.href)+"&aid=6";
lo_str="http://passport.baidu.com/?logout&aid=6&sid=&u="+escape(window.location.href);
document.write("<a href=\""+res_str+"\" >请赶快注册</a>");
</script>
<br>
</div><br>

<table width="95%" border="0" align="center" cellpadding="0" cellspacing="2" class="BG2">
<tr>
<td nowrap class="pad10L"><b>相关贴吧</b></td>
</tr>
<tr >
<td valign="middle" bgcolor="#FFFFFF" class="tbPad10">
<div class="pad10L" style="table-layout:fixed; word-break :break-all;">
<script>
if(5!=0){
document.write('<a href="/f?kw=c%D3%EF%D1%D4" title="c语言">c语言</a><br>');
document.write('<a href="/f?kw=c" title="c">c</a><br>');
document.write('<a href="/f?kw=%B3%CC%D0%F2%D4%B1" title="程序员">程序员</a><br>');
document.write('<a href="/f?kw=%BB%E3%B1%E0" title="汇编">汇编</a><br>');
document.write('<a href="/f?kw=tearfly" title="tearfly">tearfly</a>');
}
</script>
</div>
</td>
</tr>
</table>
<br>
<div id=DivIK></div>
</td></tr></table>
<table width="84%" border=0 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF" id="tbl">
<SCRIPT>
o_tbl=document.getElementById("tbl");
if(screen.width>800){
o_tbl.style.width="84%";
}else{
o_tbl.style.width="80%";
}
</SCRIPT>

<tr bgcolor="#eeeeee">
<td width="8%" nowrap class="pad10L">  点击</td>
<td width="6%" nowrap class="pad10L">回复</td>
<td class="pad10L">标题</td>
<td width="100" nowrap class="pad10L">作者</td>
<td width="135" nowrap class="pad10L">最后回复</td>
</tr>
<script>c(1);</script>
<td class="d">  1336</td>
<td class="d">38</td>
<td class="s"><a class=t href="/f?kz=96689304" target=_blank > 【隆重】C++吧开始招吧主啦!</a>[<font class="red">精品</font>] [<font class="red">置顶</font>] </td>
<td class="u"><a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=%BF%E0%D3%DA%B1%E0%B3%CC" target=_blank><font color='#000000'>苦于编程</font></a></td>
<td class="u">6-18  <a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=ruige110" target=_blank><font color='#000000'> ruige110</font></a></td>
</tr><script>c(2);</script>
<td class="d">  91</td>
<td class="d">11</td>
<td class="s"><a class=t href="/f?kz=107989315" target=_blank > 经典绝妙题目,考考你的C/C++应用能力</a>  </td>
<td class="u"><a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=lianlxz%5F518" target=_blank><font color='#000000'>lianlxz_518</font></a></td>
<td class="u">10:35  <a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=robber%5Ftys" target=_blank><font color='#000000'> robber_tys</font></a></td>
</tr><script>c(3);</script>
<td class="d">  5</td>
<td class="d">1</td>
<td class="s"><a class=t href="/f?kz=108115645" target=_blank > 【长期招聘软件高手】,兼职或全职</a>  </td>
<td class="u"><font color='#000000'>221.221.200.*</font></td>
<td class="u">10:28  <a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=liujioure" target=_blank><font color='#000000'> liujioure</font></a></td>
</tr><script>c(4);</script>
<td class="d">  1</td>
<td class="d">0</td>
<td class="s"><a class=t href="/f?kz=108115216" target=_blank > 【长期招聘软件高手】,兼职或全职.工作地点在北京</a>  </td>
<td class="u"><font color='#000000'>221.221.200.*</font></td>
<td class="u">10:08 <font color='#000000'> 221.221.200.*</font></td>
</tr><script>c(5);</script>
<td class="d">  0</td>
<td class="d">0</td>
<td class="s"><a class=t href="/f?kz=108114981" target=_blank > 【长期招聘软件高手】,兼职或全职.工作地点在北京</a>  </td>
<td class="u"><font color='#000000'>221.221.200.*</font></td>
<td class="u">10:06 <font color='#000000'> 221.221.200.*</font></td>
</tr><script>c(6);</script>
<td class="d">  1822</td>
<td class="d">103</td>
<td class="s"><a class=t href="/f?kz=101575892" target=_blank > 我认为研究生以下学历的人就不应该学c++编程!!!</a>  </td>
<td class="u"><font color='#000000'>220.249.106.*</font></td>
<td class="u">10:04 <font color='#000000'> 218.88.210.*</font></td>
</tr><script>c(7);</script>
<td class="d">  134</td>
<td class="d">9</td>
<td class="s"><a class=t href="/f?kz=106514175" target=_blank > 寻找C++编程高手</a>  </td>
<td class="u"><a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=%D1%C6%D1%C6%B9%AB%D6%F7" target=_blank><font color='#000000'>哑哑公主</font></a></td>
<td class="u">09:59  <a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=liujioure" target=_blank><font color='#000000'> liujioure</font></a></td>
</tr><script>c(8);</script>
<td class="d">  2</td>
<td class="d">0</td>
<td class="s"><a class=t href="/f?kz=108108494" target=_blank > 有谁能给我一个300-400多行的程序,啥都可以!!!</a>  </td>
<td class="u"><a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=%CB%E6%B1%E3%C0%B4%C0%B4" target=_blank><font color='#000000'>随便来来</font></a></td>
<td class="u">09:28  <a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=%CB%E6%B1%E3%C0%B4%C0%B4" target=_blank><font color='#000000'> 随便来来</font></a></td>
</tr><script>c(9);</script>
<td class="d">  142</td>
<td class="d">11</td>
<td class="s"><a class=t href="/f?kz=106514738" target=_blank > 怎么样才能找到四五百行的程序呢???</a>  </td>
<td class="u"><a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=%D1%C6%D1%C6%B9%AB%D6%F7" target=_blank><font color='#000000'>哑哑公主</font></a></td>
<td class="u">09:18  <a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=%D1%C6%D1%C6%B9%AB%D6%F7" target=_blank><font color='#000000'> 哑哑公主</font></a></td>
</tr><script>c(10);</script>
<td class="d">  426</td>
<td class="d">9</td>
<td class="s"><a class=t href="/f?kz=42607000" target=_blank > 跪求学生宿舍管理系统的c或c++语言源码,十万火急啊!!!!</a>  </td>
<td class="u"><font color='#000000'>219.140.173.*</font></td>
<td class="u">09:07 <font color='#000000'> 211.65.95.*</font></td>
</tr><script>c(11);</script>
<td class="d">  3165</td>
<td class="d">499</td>
<td class="s"><a class=t href="/f?kz=89611693" target=_blank > C++QQ群加会友</a>  </td>
<td class="u"><a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=xldn2005" target=_blank><font color='#000000'>xldn2005</font></a></td>
<td class="u">08:55 <font color='#000000'> 221.8.184.*</font></td>
</tr><script>c(12);</script>
<td class="d">  
纵横线智能化
2006-06-20 · TA获得超过1858个赞
知道大有可为答主
回答量:3615
采纳率:0%
帮助的人:1357万
展开全部
<!--STATUS OK-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>谁能给我一个400行左右的程序,什么的都可以_百度知道 </title>
<link rel="alternate" type="application/rss+xml" title="“谁能给我一个400行左右的程序,什么的都可以”的最新回答(RSS 2.0)" href="http://zhidao.baidu.com/q?ct=20&qid=8726727&pn=65535&rn=25&tn=rssqb">
<link href="/iknow.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="usrbar"><nobr><strong>gztjzxj04</strong> 高级经理 七级(9503) | <a href="http://passport.baidu.com/?center&tpl=ik&aid=7&default_tab=4&default_page=2" target="_blank">我的提问</a> | <a href="http://passport.baidu.com/?center&tpl=ik&aid=7&default_tab=4&default_page=3" target="_blank">我的回答</a> | <a href="http://passport.baidu.com/?center&tpl=ik&aid=7&default_tab=4" target="_blank">个人中心</a> | <script language="javascript">document.write('<a href="http://passport.baidu.com/?logout&aid=7&u='+escape(location.href)+'">退出</a>');</script></nobr></div>
<table width="750" border="0" cellspacing="0" cellpadding="0" class="hd"><tr>
<td width="146" valign="top"><a href="/"><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-zhidao.gif" border="0" alt="百度知道" width="137" height="46" vspace="3"></a></td>
<td><div id="tab"><a href="http://news.baidu.com/">资讯</a>   <a href="http://www.baidu.com/">网页</a>   <a href="http://post.baidu.com/">贴吧</a>   <strong>知道</strong>   <a href="http://mp3.baidu.com/">MP3</a>   <a href="http://image.baidu.com/">图片</a>   <a href="http://baike.baidu.com/">百科</a></div>
<table border="0" cellspacing="0" cellpadding="0"><tr><form action="/q" name="ftop" method="get"><td nowrap> <input class=hdi maxlength=256 tabindex=1 size=42 name=word>   </td><td><a href="http://www.baidu.com/search/zhidao_help.html">帮助</a></td></tr></table>
<div style="margin-top:4px"><input type="submit" tabindex=2 value="搜索答案" class="bnsrh"><input type="hidden" name="ct" value="17"><input type="hidden" name="pn" value="0"><input type="hidden" name="tn" value="ikaslist"><input type="hidden" name="rn" value="10"><input type="button" onclick="ask(ftop);" style="margin-left:8px" tabindex=3 value="我要提问" class="bnsrh"></div>
</form>
<form name="fask" action="/q" method="get"> <input type="hidden" name="ct" value="17"><input type="hidden" name="pn" value="0"><input type="hidden" name="tn" value="ikask"><input type="hidden" name="rn" value="12"><input type="hidden" name="word" value=""> <input type="hidden" name="cm" value="1"><input type="hidden" name="lm" value="394496"></form>
</td></tr></table>
<script language="JavaScript">function ask(fn){document.fask.word.value=fn.word.value;fask.submit();}</script>
<script>
var url = escape(location.href);

function ctlSubmit(event) {
if (event.ctrlKey && event.keyCode == 13) { fdf.submit() }
}
function checkco(f,des)
{ if(f.co.value=="") {alert("请输入您的"+des); return false;}}
function limitpl(f,des)
{ if(f.co.value=="") {alert("请输入您的"+des); return false;} return limitChars(f.co,des,200);}
function checkcoAndsn(f,des)
{ if(f.co.value=="") {alert("请输入您的"+des); return false;} return limitChars(f.sn,"参考资料",60);}
function cReply(flag)
{ if (flag=="yes") {
document.getElementById('replyTB').style.display=""; }
if(flag=="no"){document.getElementById('replyTB').style.display="none"; }
location.href="#here";
}
function fixReply(flag){ setTimeout("cReply('"+flag+"')",300);}
function limitChars(obj,obj_Str,limit_len)
{
var c = getLeftChars(obj,limit_len);
if(c<0)
{
echo_str = obj_Str + "限定在"+limit_len+"个字以内,请缩短字数";
alert(echo_str);
obj.focus();
return false;
}
return true;
}
function getLeftChars(varField,limit_len) {
var i = 0;
var cap = limit_len*2;
var j=0;
var runtime = (varField.value.length>cap)?(cap+1):varField.value.length;
for (i = 0; i< runtime; i++) {
if (varField.value.charCodeAt(i) > 127 || varField.value.charCodeAt(i) == 94) {
j=j+2;
}
else {
j=j+1
}
}
var leftchars = cap - j;
return (leftchars);
}
</script>
<div id="main">
<div class="path"><a href="/">百度知道</a> > <a href="/browse/74?lm=9">电脑/数码</a> > <a href="/browse/93?lm=9">编程</a></div>

<div id="right">

<div class="t3 bcy bgy">快到期问题</div>
<div class="b3 bcy mb12">
<table border="0" cellpadding="0" cellspacing="0" class="wr">
<tr><td width=10 valign="top">• </td>
<td><a href="/question/8213060.html?md=1" target="_blank">.net 下最好的ajax解决方案是什么?</a></td></tr><tr><td width=10 valign="top">• </td>
<td><a href="/question/8212915.html?md=1" target="_blank">VB+Map-X里如何实现地图的测距?</a></td></tr><tr><td width=10 valign="top">• </td>
<td><a href="/question/8212609.html?md=1" target="_blank">关于jsp与acess的问题,如何把整列数据提交</a></td></tr><tr><td width=10 valign="top">• </td>
<td><a href="/question/8212535.html?md=1" target="_blank">if a trial balance does balance,that insure ledger correct?explain</a></td></tr><tr><td width=10 valign="top">• </td>
<td><a href="/question/8210429.html?md=1" target="_blank">问道C语言编程:title:目录</a></td></tr>
<tr><td width="10"> </td><td height="22" align="left"><a href="/browse/93?lm=6" class="lmore">更多>></a></td></tr></table>
</div>

<div class="mb12"><a href="/q?ct=20&qid=8726727&pn=65535&rn=25&tn=rssqb" target="_blank" title="订阅“谁能给我一个400行左右的程序,什么的都可以”的最新回答"><img src="http://www.baidu.com/search/img/rss_xml.jpg" border="0" width="36" height="14" align="absmiddle"></a>  订阅该问题</div>

<div class="b4y gray mb12">
您想在自己的网站上展示百度“知道”上的问答吗?来<a href="/iknowcode.html" target="_blank">获取免费代码</a>吧!
<hr size="1">如要投诉或提出意见建议,请到<br><a href="http://post.baidu.com/f?kw=%B0%D9%B6%C8%D6%AA%B5%C0%CD%B6%CB%DF" target="_blank">百度知道投诉吧</a>反馈。
</div>

</div>

<div id="center">
<div class="bai">

<div class="t3 bcg bgg">待解决</div>
<div class="b3 bcg mb12">
<div class="p90">
<div class="f14 B wr">谁能给我一个400行左右的程序,什么的都可以</div>
<div class="wr"><span class="red"><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/iknow/icn_point.gif" width="16" height="16" align="absmiddle"> 悬赏分:30</span> - <span class="gray">离问题结束还有 14 天 23 小时</span></div>
<div class="wr f14">没忘了概述我这是关于什么的程序</div>
<div class="wr f14"></div>
<div align="right" class="gray wr">提问者:<a href="http://passport.baidu.com/?detail&aid=7&default_tab=2&un=%CB%E6%B1%E3%C0%B4%C0%B4" target=_blank>随便来来</a> - <a href="http://www.baidu.com/search/zhidao_help.html#n5" target=_blank>见习魔法师 二级</a> </div>
<div><input type=button value="我来回答" onClick="location.href='#reply';"></div>

</div></div><!--b3+p90-->

<div class="t3 bcg bgg" style="position:relative">答复<div style="position:absolute;top:4px;right:10px;font-size:12px;font-weight:normal">共 1 条</div></div>
<div class="b3 bcg mb12">
<div class="p90 wr">

<a name="34385691"><div class="f14">留言本,
<br>新闻
<br>
<br>400行都能实现,
<br>很多程序都行了, </div>

<div align="right" class="gray">回答者:<a href="http://passport.baidu.com/?detail&aid=7&default_tab=2&un=bobotli" target=_blank>bobotli</a> - <a href="http://www.baidu.com/search/zhidao_help.html#n5" target=_blank>魔法师 五级</a> 6-20 09:19</div>

<div id="Lg"></div>

</div></div>

<form method="post" name="fdf" action="/q" onSubmit="return checkcoAndsn(this,'回答');">
<input type="hidden" name="ct" value="22">
<input type="hidden" name="cm" value="100009">
<input type="hidden" name="tn" value="ikreplysubmit">
<input type="hidden" name="qid" value="8726727">
<input type="hidden" name="cid" value="93">
<script language="javascript">
document.write("<input type=hidden name=lu value="+escape(location.href)+ ">");
</script>
<div class="b4g">
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="22%" nowrap class="f14"><a name="reply"></a>我也来回答:</td>
<td width="78%"><textarea name="co" cols="50" rows="10" onKeyDown="ctlSubmit(event);" style="width:97%;"></textarea> <br> 回答即可得2分,回答被采纳则获得悬赏分以及奖励20分。 <a href="http://www.baidu.com/search/zhidao_help.html#n4">积分规则</a><br>回答字数在10000字以内</td>
</tr>
</table>
<br> <table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="22%" nowrap class="f14">参考资料:</td>
<td width="78%"><input name="sn" type="text" size="50" onKeyDown="ctlSubmit(event);">
<br> <span class="style3">如果您的回答是从其他地方引用,请表明出处。</span> </td>
</tr>
</table>
<br> <table width="90%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="22%" class="f14"> </td>
<td width="78%"><input type="submit" value="提交回答" class="bnsrh">
<input type="checkbox" name="md" value="1" style="margin-left:40px;">
匿名回答 </td>
</tr>
</table>
</div>
</form>

</div></div>
</div>
<div id="cp"><a href="http://www.baidu.com/duty/copyright.html">©2006</a> Baidu</div>
<!--[if IE]>
<script language="JavaScript">
var objmain = document.getElementById("main");
function updatesize(){ var bodyw = window.document.body.offsetWidth; if(bodyw <= 792) objmain.style.width="752px"; else if(bodyw >= 1016) objmain.style.width="976px"; else objmain.style.width="100%"; }
updatesize(); window.onresize = updatesize;
</script>
<![endif]-->
</body>
</html>
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
西瓜盗圣
2006-06-20 · TA获得超过687个赞
知道小有建树答主
回答量:632
采纳率:0%
帮助的人:679万
展开全部
#define BlockSize 16
#define BlockNum 1000
#define MaxBlockNumForFile 16
#define MaxFileLength ((BlockSize)*(MaxBlockNumForFile))
#define MaxUserNum 8
#define MaxFileNumForUser 16
#define MaxOpenFileNum 4
#include<stdio.h>
#include<string.h>
/*struct define*/
typedef struct
{
char UserName[16];
char UserPwd[16];
int UserGroup;
int FlagInUse;
}UserInfo;

typedef struct
{
char text[BlockSize];
}BlockStruct;

typedef struct
{
char FileName[16];
int FileAttrib;
int FileLength;
int FileBlock[MaxBlockNumForFile];
int FlagInUse;
}FileCtrlBlock;

typedef struct
{
FileCtrlBlock FCB[MaxFileNumForUser];
}UserFileDir;

typedef struct
{
char UserName[16];
int UFDAddr;
}MainFileDir;

typedef struct
{
char FileName[16];
int FileAttrib;
int FileLength;
int FileState; /*0:create,1:open*/
int ReadPointer;
int WritePointer;
int FlagInUse;
}UserOpenFile;
/*initialize*/
UserInfo USER[MaxUserNum];
MainFileDir MFD[MaxUserNum];
UserFileDir UFD[MaxUserNum];
BlockStruct BLOCK[BlockNum];
int BlockIsUse[BlockNum];
UserOpenFile UOF[MaxUserNum][MaxOpenFileNum];
char ActiveUser[16];
char Domain[16]={"localhost"};
char Directory[16];
int mfdindex,ufdindex,fileindex;
/*function define*/
void cls(void)
{
int i;
for (i=0;i<24 ;i++ )
{
printf("\n");
}
}
int AddUser(char uname[16],char upwd[16],int ugroup)
{
int i;
for (i=0;i<MaxUserNum;i++)
{
if (USER[i].FlagInUse&&!strcmp(USER[i].UserName,uname))
{
printf("User %s has already exist.",uname);
return -1;
}
}
for (i=0;i<MaxUserNum ;i++ )
{
if (USER[i].FlagInUse)
{
continue;
}
strcpy(USER[i].UserName,uname);
strcpy(USER[i].UserPwd,upwd);
USER[i].UserGroup=ugroup;
USER[i].FlagInUse=1;
strcpy(MFD[i].UserName,uname);
MFD[i].UFDAddr=i;
return 0;
}
printf("\nUsers\' number has reached the max value.");
return -1;
}
int DelUser(char uname[16])
{
int i,j;
if (!strcmp(uname,USER[0].UserName))
{
printf("\nuser \'%s\' must in the system.",USER[0].UserName);
return -1;
}
if (!strcmp(uname,ActiveUser))
{
printf("\nYou can not delete yourself.");
return -1;
}
for (i=0;i<MaxUserNum;i++)
{
if (USER[i].FlagInUse&&!(strcmp(USER[i].UserName,uname)))
{
for (j=0;j<MaxFileNumForUser;j++)
{
if (UFD[ufdindex].FCB[j].FlagInUse)
{
printf("User has file in the system.");
return -1;
}
}
USER[i].FlagInUse=0;
return 0;
}
}
printf("user \'%s\' not exist.",uname);
return -1;
}
void shell(void)
{
char sign='#';
if (strcmp(ActiveUser,"root"))
{
sign='$';
}
printf("\n[%s@%s %s]%c ",ActiveUser,Domain,ActiveUser,sign);
}
int Login(char uname[16],char upwd[16])
{
int i;
for (i=0;i<MaxUserNum;i++)
{
if (!USER[i].FlagInUse||strcmp(USER[i].UserName,uname))
{
continue;
}
else if (strcmp(USER[i].UserPwd,upwd))
{
printf("Password incorrect.");
return -1;
}
else
return 0;
}
printf("User %s not exist.",uname);
return -1;
}
int Login_fun(void)
{
char uname[16],upwd[16];
int i=0,key=0;
fflush(stdin);
printf("login:");
scanf("%s",uname);
printf("Password:");
while (key!=13&&i<15)
{
if (kbhit())
{
key=getch();
upwd[i++]=key;
}
}
upwd[i-1]='\0';
if (!Login(uname,upwd))
{
strcpy(ActiveUser,uname);
strcpy(Directory,uname);
for (i=0;i<MaxFileNumForUser;i++)
{
if (USER[i].FlagInUse&&!strcmp(MFD[i].UserName,ActiveUser))
{
mfdindex=i; break;
}
}
ufdindex=MFD[mfdindex].UFDAddr;
return 0;
}
else{
printf("Login incorrect.\n");
if (Login_fun())
return -1;
else
return 0;
}
}
int GeneralInitialize(void)
{

printf("\n%s ",Domain);
AddUser("root","root",1);
return 0;
}
int SeekFreeBlock(void)
{
static int i=0;
int j;
for (;i<BlockNum;i++)
{
if (!BlockIsUse[i])
{
BlockIsUse[i]=1;
return i;
}
}
for (j=0;j<BlockNum;j++)
{
if (!BlockIsUse[j])
{
BlockIsUse[j]=1;
return j;
}
}
return -1;
}
int Create(char fname[16],int flength,int fattrib)
{
int i,j=0,k,flag,uofindex,alocblock[MaxBlockNumForFile];
if (flength>=MaxFileLength)
{
printf("File Length too long.");
return -1;
}
if (fattrib!=0&&fattrib!=1)
{
printf("File Attribute Error.");
return -1;
}
for (i=0;i<MaxFileNumForUser;i++)
{
if (UFD[ufdindex].FCB[i].FlagInUse&&!strcmp(UFD[ufdindex].FCB[i].FileName,fname))
{
printf("Filename has already been used.");
return -1;
}
}
for (i=0;i<MaxOpenFileNum;i++)
{
if (!UOF[mfdindex][i].FlagInUse)
{
break;
}
}
if (i==MaxOpenFileNum)
{
printf("Can not open more files.");
return -1;
}
uofindex=i;
for (i=0;i<MaxFileNumForUser;i++)
{
if (!UFD[ufdindex].FCB[i].FlagInUse)
{
break;
}
}
if (i==MaxFileNumForUser)
{
printf("Can not create more files.");
return -1;
}
fileindex=i;
k=flength;
do
{
if (-1==(i=SeekFreeBlock()))
{
printf("Not enough free space.");
return -1;
}
alocblock[j++]=i;
k-=BlockSize;
} while(k>0);
for (i=0;i<MaxBlockNumForFile;i++)
{
if (i<j)
{
UFD[ufdindex].FCB[fileindex].FileBlock[i]=alocblock[i];
}
else
{
UFD[ufdindex].FCB[fileindex].FileBlock[i]=-1;
}
}
UOF[mfdindex][uofindex].ReadPointer=0;
UOF[mfdindex][uofindex].WritePointer=0;
strcpy(UFD[ufdindex].FCB[fileindex].FileName,fname);
UFD[ufdindex].FCB[fileindex].FileAttrib=fattrib;
UFD[ufdindex].FCB[fileindex].FileLength=flength;
UFD[ufdindex].FCB[fileindex].FlagInUse=1;
strcpy(UOF[mfdindex][uofindex].FileName,fname);
UOF[mfdindex][uofindex].FileAttrib=fattrib;
UOF[mfdindex][uofindex].FileLength=flength;
UOF[mfdindex][uofindex].FileState=0;
UOF[mfdindex][uofindex].FlagInUse=1;
return 0;
}
int Open(char fname[16],int opreate)
{
int i,flag=0;
for (i=0;i<MaxFileNumForUser;i++)
{
if (UFD[ufdindex].FCB[i].FlagInUse&&!strcmp(UFD[ufdindex].FCB[i].FileName,fname))
{
fileindex=i;
flag=1; break;
}
}
if (!flag)
{
printf("File %s not exist.",fname);
return -1;
}
flag=0;
for (i=0;i<MaxOpenFileNum;i++)
{
if (UOF[mfdindex][i].FlagInUse&&!strcmp(UOF[mfdindex][i].FileName,fname))
{
flag=1; break;
}
}
if (flag)
{
if (UOF[mfdindex][i].FileState==0)
{
printf("File under creating.");
}
else
{
printf("File has already been opened.");
}
return -1;
}
else
{
if (UFD[ufdindex].FCB[fileindex].FileAttrib<opreate)
{
printf("File is ReadOnly.");
return -1;
}
for (i=0;i<MaxOpenFileNum;i++)
{
if (UOF[mfdindex][i].FlagInUse==0)
{
break;
}
}
if (i==MaxOpenFileNum)
{
printf("Can not open more files.");
return -1;
}
strcpy(UOF[mfdindex][i].FileName,UFD[ufdindex].FCB[fileindex].FileName);
UOF[mfdindex][i].FileAttrib=opreate;
UOF[mfdindex][i].FileLength=UFD[ufdindex].FCB[fileindex].FileLength;
UOF[mfdindex][i].FileState=1;
UOF[mfdindex][i].FlagInUse=1;
UOF[mfdindex][i].ReadPointer=0;
UOF[mfdindex][i].WritePointer=0;
return 0;
}
}
int Write(char fname[16],int wrpoint)
{
int i,j,k,wrlong,b,e;
char str[MaxFileLength];
for (i=0;i<MaxOpenFileNum;i++)
{
if (UOF[mfdindex][i].FlagInUse&&!strcmp(UOF[mfdindex][i].FileName,fname))
{
break;
}
}
if (MaxOpenFileNum==i)
{
printf("File was not been created nor opened.");
return -1;
}
fileindex=i;
if (UOF[mfdindex][fileindex].FileState&&!UOF[mfdindex][fileindex].FileAttrib)
{
printf("The file is ReadOnly.");
return -1;
}
if (-1==wrpoint)
{
wrpoint=UOF[mfdindex][fileindex].WritePointer;
}
gets(str);
wrlong=strlen(str);
if (wrlong+wrpoint>=UOF[mfdindex][fileindex].FileLength)
{
printf("Write too long.");
return -1;
}
i=0;k=0;
for (i=wrpoint/BlockSize;i<(wrlong+wrpoint)/BlockSize+1;i++)
{
b=(wrpoint<i*BlockSize)?0:wrpoint%BlockSize;
e=((i+1)*BlockSize-1<wrlong+wrpoint)?(BlockSize-1):(wrlong+wrpoint)%BlockSize;
for (j=b;j<=e;j++)
{
BLOCK[UFD[ufdindex].FCB[fileindex].FileBlock[i]].text[j]=str[k++];
}
}
BLOCK[UFD[ufdindex].FCB[fileindex].FileBlock[i]].text[k]='\0';
UOF[mfdindex][fileindex].WritePointer=wrlong+wrpoint;
return 0;
}
int Read(char fname[16],int rlength)
{
int i,j,k,b,e,reachpoint;
char tmpBlock[BlockSize+1];
for (i=0;i<MaxOpenFileNum;i++)
{
if (UOF[mfdindex][i].FlagInUse&&!strcmp(UOF[mfdindex][i].FileName,fname))
{
break;
}
}
if (MaxOpenFileNum==i)
{
printf("File was not existed nor opened.");
return -1;
}
fileindex=i;
if (rlength)
{
reachpoint=UOF[mfdindex][fileindex].ReadPointer+rlength;
}
else
{
reachpoint=UOF[mfdindex][fileindex].FileLength-1;
}
if (reachpoint>=UOF[mfdindex][fileindex].FileLength)
{
printf("File length not more than %d.",reachpoint);
return -1;
}
i=0;
for (i=UOF[mfdindex][fileindex].ReadPointer/BlockSize;i<reachpoint/BlockSize+1;i++)
{
b=(UOF[mfdindex][fileindex].ReadPointer<i*BlockSize)?0:UOF[mfdindex][fileindex].ReadPointer%BlockSize;
e=((i+1)*BlockSize-1<reachpoint)?BlockSize-1:reachpoint%BlockSize;
k=0;
for (j=b;j<e;j++)
{
tmpBlock[k++]=BLOCK[UFD[ufdindex].FCB[fileindex].FileBlock[i]].text[j];
}
tmpBlock[k]='\0';
printf("%s",tmpBlock);
}
UOF[mfdindex][fileindex].ReadPointer=reachpoint;
return 0;
}
int Close(char fname[16])
{
int i;
for (i=0;i<MaxOpenFileNum;i++)
{
if (UOF[mfdindex][i].FlagInUse&&!strcmp(UOF[mfdindex][i].FileName,fname))
{
break;
}
}
if (MaxOpenFileNum==i)
{
printf("File has not been opened.");
return -1;
}
UOF[mfdindex][i].FlagInUse=0;
return 0;
}
int Delete(char fname[16])
{
int i;
for (i=0;i<MaxFileNumForUser;i++)
{
if (UFD[ufdindex].FCB[i].FlagInUse&&!strcmp(UFD[ufdindex].FCB[i].FileName,fname))
{
break;
}
}
if (MaxFileNumForUser==i)
{
printf("File not exist.");
return -1;
}
fileindex=i;
for (i=0;i<MaxOpenFileNum;i++)
{
if (UOF[mfdindex][i].FlagInUse&&!strcmp(UOF[mfdindex][i].FileName,fname))
{
printf("Please close file first when you wanna delete it.");
return -1;
}
}
for (i=0;i<MaxBlockNumForFile;i++)
{
BlockIsUse[UFD[ufdindex].FCB[fileindex].FileBlock[i]]=0;
UFD[ufdindex].FCB[fileindex].FileBlock[i]=-1;
}
UFD[ufdindex].FCB[fileindex].FlagInUse=0;
return 0;
}
long StrToInt(char *str)
{
long result=0; int i=0;
while (*(str+i)!='\0'&&*(str+i)>47&&*(str+i)<58)
{
result=result*10+*(str+i++)-48;
}
return result;
}
void ls(int mode)
{
int i;
for (i=0;i<MaxFileNumForUser;i++)
{
if (UFD[ufdindex].FCB[i].FlagInUse)
{
if (mode)
{
printf("%s\t\t%d\t%d\t%s\n",UFD[ufdindex].FCB[i].FileName,UFD[ufdindex].FCB[i].FileLength,UFD[ufdindex].FCB[i].FileAttrib,Directory);
}
else
{
printf("%s\t",UFD[ufdindex].FCB[i].FileName);
}
}
}
}
void lsUFD(void)
{
int i,j,k;
for (i=0;i<MaxUserNum;i++)
{
if (USER[i].FlagInUse)
{
printf("/%s:\n",USER[i].UserName);
for (j=0;j<MaxFileNumForUser;j++)
{
if (UFD[i].FCB[j].FlagInUse)
{
printf("%s\t%d\t%d\t%s\tBlock[",UFD[i].FCB[j].FileName,UFD[i].FCB[j].FileLength,UFD[i].FCB[j].FileAttrib,USER[i].UserName);
for (k=0;k<MaxBlockNumForFile;k++)
{
if (UFD[i].FCB[j].FileBlock[k]!=-1)
{
printf("%d ",UFD[i].FCB[j].FileBlock[k]);
}
}
printf("]\n");
}
}
printf("\n");
}
}
}
void lsUOF(void)
{
int i,j,k;
for (i=0;i<MaxUserNum;i++)
{
if (USER[i].FlagInUse)
{
printf("User: %s\n",USER[i].UserName);
for (j=0;j<MaxOpenFileNum;j++)
{
if (UOF[i][j].FlagInUse)
{
printf("%s\t%d\t%d\t%d\t%s\t%d\t%d\n",UOF[i][j].FileName,UOF[i][j].FileAttrib,UOF[i][j].FileLength,UOF[i][j].FileState,USER[i].UserName,UOF[i][j].ReadPointer,UOF[i][j].WritePointer);
}
}
printf("\n");
}
}
}
void help()
{
printf("\n\tWelcome to use 5428 File System.There are inner commands:");
printf("\n\t---------------------------------------------------------");
printf("\n\t\tadduser USERNAME PASSWORD GROUP");
printf("\n\t\tdeluser USERNAME");
printf("\n\t\tcreate FILENAME LENGTH ATTRIB");
printf("\n\t\topen FILENAME [OPERATE]");
printf("\n\t\tread FILENAME [LENGTH]");
printf("\n\t\twrite FILENAME [WRITEPOINT]");
printf("\n\t\tclose FILENAME");
printf("\n\t\tdelete|rm FILENAME");
printf("\n\t\tufd|UFD");
printf("\n\t\tuof|UOF");
printf("\n\t\tlogin");
printf("\n\t\tend");
printf("\n\t\thelp");
printf("\n\t\tls [-l]");
printf("\n");
}
int main()
{
int i,j,k,argc,key=0;
char cmd[64],argv[4][16],tmp[16];
GeneralInitialize();
// AddUser("ingu","ingu",2);
AddUser("5428","5428",2);
Login_fun();
Create("test",64,1);
while (1)
{
shell();
fflush(stdin);
gets(cmd);
if (!strcmp(cmd,"end"))
{
exit(0);
}
for (i=0;i<4;i++)
{
argv[i][0]='\0';
}
for (argc=0,i=0,j=0;i<64&&cmd[i]!='\0';)
{
if (cmd[i]==' ')
{
argv[argc++][j]='\0'; i++; j=0;
}
argv[argc][j++]=cmd[i++];
}
argv[argc][j]='\0';
if (!strcmp(argv[0],"login"))
{
Login_fun();
}
else if (!strcmp(argv[0],"ls"))
{
if (!strcmp(argv[1],"-l"))
{
ls(1);
}
else
ls(0);
}
else if (!strcmp(argv[0],"adduser"))
{
while (!strcmp(argv[1],""))
{
printf("User Name:");
gets(argv[1]);
}
while (!strcmp(argv[2],""))
{
printf("User Password:");
i=0;fflush(stdin);
while (key!=13&&i<15)
{
if (kbhit())
{
key=getch();
tmp[i++]=key;
}
}
tmp[i-1]='\0';
strcpy(argv[2],tmp);
}
if (!strcmp(argv[3],"1"))
{
k=1;
}
else
{
k=0;
}
AddUser(argv[1],argv[2],k);
}
else if (!strcmp(argv[0],"deluser"))
{
while (!strcmp(argv[1],""))
{
printf("Who do you want to kill?");
gets(argv[1]);
}
DelUser(argv[1]);
}
else if (!strcmp(argv[0],"create"))
{
while (!strcmp(argv[1],""))
{
printf("File Name:");
gets(argv[1]);
}
while (!strcmp(argv[2],""))
{
printf("File Length:");
gets(argv[2]);
}
if (!strcmp(argv[3],"1"))
{
k=1;
}
else
{
k=0;
}
Create(argv[1],(int)StrToInt(argv[2]),k);
}
else if(!strcmp(argv[0],"open"))
{
while (!strcmp(argv[1],""))
{
printf("File Name:");
gets(argv[1]);
}
k=0;
if (!strcmp(argv[2],"1"))
{
k=1;
}
Open(argv[1],k);
}
else if (!strcmp(argv[0],"read"))
{
while (!strcmp(argv[1],""))
{
printf("File Name:");
gets(argv[1]);
}
i=0;
if (strcmp(argv[2],""))
{
i=(int)StrToInt(argv[2]);
}
Read(argv[1],i);
}
else if (!strcmp(argv[0],"write"))
{
while (!strcmp(argv[1],""))
{
printf("File Name:");
gets(argv[1]);
}
i=-1;
if (strcmp(argv[2],""))
{
i=(int)StrToInt(argv[2]);
}
Write(argv[1],i);
}
else if (!strcmp(argv[0],"close"))
{
while (!strcmp(argv[1],""))
{
printf("File Name:");
gets(argv[1]);
}
Close(argv[1]);
}
else if (!strcmp(argv[0],"delete")||!strcmp(argv[0],"rm"))
{
while (!strcmp(argv[1],""))
{
printf("File Name:");
gets(argv[1]);
}
Delete(argv[1]);
}
else if (!strcmp(argv[0],"ufd")||!strcmp(argv[0],"UFD"))
{
lsUFD();
}
else if (!strcmp(argv[0],"uof")||!strcmp(argv[0],"UOF"))
{
lsUOF();
}
else if (!strcmp(argv[0],"help"))
{
help();
}
else printf("%s is not a command!",argv[0]);
}
return 0;
}

、缓冲管理(双缓冲/循环缓冲/缓冲池)
要求:
(1)模拟双缓冲、循环缓冲的读写同步过程(初态(各缓冲区的空、满等)自行给出);
(2)模拟缓冲池中缓冲区在不同工作方式下,所导致的缓冲队列的变化情况。
其中,初态(空缓冲队列、输入队列、输出队列等)自行给出;选择一种缓冲区的工作方式,查看各缓冲队列的变化情况。
2、 设计一个小型文件系统,提供创建、打开、读、写、关闭、删除文件的功能。
其中:(1). 文件的内容象征性给出;
(2). 基本文件目录、符号文件目录 ,活动文件表、活动名字表结构自行给出;
(3). 提供存储管理功能(内存、外存);
(4). 提供文件保密措施 。
要求:(1). 有方便使用的用户界面;
(2). 要求每执行一次命令(创建、打开、读、写、关闭、删除)后,检查:
基本文件目录、符号文件目录、活动文件表、活动名字表、存储管理情况。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友3cb80af
2006-06-20 · TA获得超过9535个赞
知道大有可为答主
回答量:1.2万
采纳率:83%
帮助的人:3973万
展开全部
留言本,
新闻

400行都能实现,
很多程序都行了,
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式