.read()方法返回的是读取的内容吧,那么这段代码的倒数第二行第三行怎么解释呢?求各位大佬教导

File file = new File(fileName);
FileReader readIn = new FileReader(file);

int size = (int)file.length();

int charsRead = 0;

char[] content = new char[size];

while(readIn.ready())

charsRead += readIn.read(content, charsRead, size - charsRead);

readIn.close();

1个回答

public int read(char [] c, int offset, int len)
这是filereader里read方法的方法名,用途是读取字符到c数组,返回读取到字符的个数
三个参数分别的意思是,将文件中内容读到数组c中,读取开始的索引是offset,读取长度是len,
而返回值是读取到的字符的个数。

所以你这里倒数第二第三行的意思很明显,
当能够继续读取时,将文件的未读部分(即charsread后面的部分)读取到content数组中,
因为不能够超出数组索引,所以第三个参数是size-charsread.
返回值是读取到的字符的长度,累加到charsread上就是已经读取过的字符长度。

weixin_44118331
昔我往矣~杨柳依依 charsRead += readIn.read(content, charsRead, size - charsRead);刚开始charsread为0,那么就是从索引为0到size所有的数据全部都读进去了吗?这样读一次不就行了吗?
9 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
这段代码怎么解释呢
// S1F2rnpublic void Send_ONLINE_Grant( MCData aData )rn rn tryrn rn SXTransaction SxTrx = new SXTransaction();rn SxTrx.MessageName = "S1F2";rnrn SxTrx.Stream = 1;rn SxTrx.Function = 2;rnrn SxTrx.WriteNode( SX.SECSFormat.L, 2, null, "COUNT" );rn SxTrx.WriteNode ( SX.SECSFormat.A,6,"test01","MDLN",0);rn SxTrx.WriteNode ( SX.SECSFormat.A,6, "TEST02", "SOFTREV",0 );rnrn MCApplication.This().BaseSECSWrapper.Reply( null, SxTrx, aData.SECSData.HeaderItems.SystemBytes );rn MCApplication.This().BaseLogManager.WriteLog( "[ Snd S1F2 ] ONLINE Grant", LogLevel.L3_INFO );;rn rn catch(Exception e)rn rn MCApplication.This().BaseLogManager.WriteLog("Function(Send_ONLINE_Grant) Fail : " + e.Message, LogLevel.L5_FAIL );rn rn rnrn这段代码怎么解释呢?
问题描述在倒数第三行的注释,读取二进制文件
Private Sub Command1_Click()rnrnrnWinClient.RemoteHost = "127.0.0.1"rnWinClient.RemotePort = 1001rnWinClient.Connect ' 进行连接rnrnrnEnd SubrnrnPrivate Sub Command2_Click()rn rn If WinClient.State <> 7 Thenrn Exit Subrn End Ifrn rn rn Dim FLen As Longrn Dim Fdata() As Bytern Dim Alist As Longrn rn rn FLen = FileLen("c:\a.bmp") '获取文件长度rn rn Open "c:\a.bmp" For Binary As 1 '打开文件,文件号为1rn rn For Alist = 1 To FLen Step 1000 '每次读取1024个字节rn DoEventsrn rn If Alist + 1000 > FLen Thenrn ReDim Preserve Fdata(FLen - Alist)rn Get #1, Alist, Fdata '读取文件数据rn End If '如果剩下的字节数小于1024rn rn rn If Alist + 1000 < FLen Thenrn ReDim Preserve Fdata(1000)rn Get #1, Alist, Fdatarn End If '如果剩下的字节数大于等于1024rn rn rn rn WinClient.SendData Fdatarn rn rn Me.Caption = Val(Me.Caption) + UBound(Fdata)rn '这里显示的数据总比实际值小1,为什么,想了很久,没找到问题所在,请指教!rn Nextrn rnEnd Sub
求各位大佬通俗解释下
![图片](https://img-ask.csdn.net/upload/201706/03/1496475705_796426.png)
帮我解释下这段代码吧~
谁能给我详细解释下这代码,是书里面的搞了好久搞不懂~~rnrnrnvoid GradeBook::outputBarChart()rnrn cout<< "\nOverall Grade distribution: " << endl;rnrn const int frequencySize = 11;rn int frequency[ frequencySize ] = 0 ;rnrn for( int student = 0; student < students; student++ )rn for( int test = 0; test < tests; test++ )rn ++frequency[ grades[ student ] [ test ] / 10 ];rnrnrn for( int count = 0; count < frequencySize; count++ )rn rn if( count == 0 )rn cout<< " 0-9: ";rn else if( count == 10 )rn cout<<" 100: ";rn elsern cout<< count * 10 << "-" << ( count * 10 ) + 9 << ": ";rnrn for( int stars = 0; stars < frequency[ count ]; stars++ )rn cout<< "*";rnrn cout<< endl;rn rn
求解释这段代码!
rn
求解释这段代码
[code=C/C++]rn//功能:取得字段中的字符串rn//index:字段集中的索引rn//strSum:返回的字符的长度(<=实际:代表全部返回,>实际:左补空格)rnCString CADOConn::GetValueString(int index,int strSum)rnrn _variant_t vValue;//var型返回值rn _variant_t vIndex;//索引rn CString strValue,strType,str;//strValue:初始返回值 strType:格式化字符串 str:最终返回值rn vIndex.vt=VT_I2;rn vIndex.iVal=index;rn vValue=m_pRecordset->Fields->GetItem(vIndex)->Value;rn switch(vValue.vt)rn rn case VT_NULL:rn str="";rn break;rn case VT_ERROR:rn str="";rn break; rn case VT_EMPTY:rn str="";rn break;rn default:rn str=(LPCSTR)_bstr_t(vValue);rn rn strType.Format(L"%d",strSum);rn strType=L"%"+strType+L"s";rn strValue.Format(strType,str);rn return strValue; rn[/code]rnrn下面是调用这个函数的,如下:rn[code=C/C++]rnstrPassword=adoMain.GetValueString(0,0);rnm_strUserName = adoMain.GetValueString(1,0);[/code]rnrn求牛人解释下上面的那个函数。
求这段代码的解释
cmp %ecx, %ebxrnsetl %alrnmovzbl %al, %eaxrnrn要实现的功能是比较ecx和ebx的大小,rn如果ebx
这段代码是怎么的呢?
微软的原文,在制作OFFICE文档级程序中使用,正确,没有问题。rnprivate void ExcelRangeAddControl()rnrnrn UserControl1 customUserControl = new UserControl1();rn UserControl2 customUserControl2 = new UserControl2();rnrn Microsoft.Office.Tools.Excel.ControlSite dynamicControl =rn [color=#FF0000]this.[/color]Controls.AddControl(customUserControl,rn 0, 0, 150, 150, "dynamicControl");rnrn Microsoft.Office.Tools.Excel.ControlSite dynamicControl2 =rn [color=#FF0000]this.[/color]Controls.AddControl(customUserControl2, 200, 0,rn 150, 150, "dynamicControl2");rnrn customUserControl.BackColor = Color.Blue;rn customUserControl2.BackColor = Color.Green;rnrn customUserControl.Top = 100;rn dynamicControl2.Top = 100;rnrnrnrn可是,在外接程序中,就需要修改实例化对象(红色的This),请问在外接程序开发中,需要修改成什么。
这段代码取第三行第二列怎么写?
rn DutySql = "select * from XXX"rn DataSet ds = DbClass.getDateSet(DutySql);rn int i = ds.Tables[0].Rows.Count;rn 想去列表里的第三行第二列。?rn不知怎么写?
怎么解释这段代码?
DECLARE @cmd sysname, @var sysnamernSET @var = 'dir /p'rnSET @cmd = 'echo ' + @var + ' > dir_out.txt'rnEXEC master..xp_cmdshell @cmdrn这段代码是用来将变量值写入文本文件的rn但是我看不懂rn请高人指教
这段代码怎么解释?
>>> True,False = False,Truern>>> bool(True)rnFalsern>>> bool(False)rnTruernrn书上看到这段代码,觉得很不解,求指教:rn1、第一行,False本身不是个变量,而是个值,为什么能自行赋值?rn2、为什么执行第一行之后,bool(True)变成了False?
这段代码怎么解释
如题,不求每句代码都有解释,只是希望了解函数调用的作用,请尽可能详细些rnrn[code=C/C++]rnBOOL Func() rn rn#define ACCESS_READ 1 rn#define ACCESS_WRITE 2 rnrn HANDLE hToken; rn DWORD dwStatus; rn DWORD dwAccessMask; rn DWORD dwAccessDesired; rn DWORD dwACLSize; rn DWORD dwStructureSize = sizeof(PRIVILEGE_SET); rn PACL pACL = NULL; rn PSID psidAdmin = NULL; rn BOOL bReturn = FALSE; rn PRIVILEGE_SET ps; rn GENERIC_MAPPING GenericMapping; rn PSECURITY_DESCRIPTOR psdAdmin = NULL; rn SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY; rnrn if(!ImpersonateSelf(SecurityImpersonation)) rn goto LeaveIsAdmin; rnrn if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &hToken)) //?Token怎么解释rn rn if (GetLastError() != ERROR_NO_TOKEN) rn goto LeaveIsAdmin; rnrn if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) //?rn goto LeaveIsAdmin; rnrn if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) //为什么要重复一遍rn goto LeaveIsAdmin; rn rnrn if (!AllocateAndInitializeSid(&SystemSidAuthority, 2, rn SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, rn 0, 0, 0, 0, 0, 0, &psidAdmin)) //?rn goto LeaveIsAdmin; rnrn psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH); //?分配空间做什么?rn if (psdAdmin == NULL) rn goto LeaveIsAdmin; rnrn if (!InitializeSecurityDescriptor(psdAdmin, rn SECURITY_DESCRIPTOR_REVISION)) //?rn goto LeaveIsAdmin; rnrn dwACLSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + rn GetLengthSid(psidAdmin) - sizeof(DWORD); rnrn pACL = (PACL)LocalAlloc(LPTR, dwACLSize); //? pACL是做什么的?rn if (pACL == NULL) rn goto LeaveIsAdmin; rnrn if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2)) rn goto LeaveIsAdmin; rnrn dwAccessMask= ACCESS_READ | ACCESS_WRITE; rnrn if (!AddAccessAllowedAce(pACL, ACL_REVISION2, dwAccessMask, psidAdmin)) //?rn goto LeaveIsAdmin; rnrn if (!SetSecurityDescriptorDacl(psdAdmin, TRUE, pACL, FALSE)) //?rn goto LeaveIsAdmin; rnrn if(!SetSecurityDescriptorGroup(psdAdmin, psidAdmin, FALSE)) //?rn goto LeaveIsAdmin; rn if(!SetSecurityDescriptorOwner(psdAdmin, psidAdmin, FALSE)) //为什么要重复一遍?rn goto LeaveIsAdmin; rnrn if (!IsValidSecurityDescriptor(psdAdmin)) // 有效or无效的判断依据是什么?rn goto LeaveIsAdmin; rnrn dwAccessDesired = ACCESS_READ; rnrn GenericMapping.GenericRead = ACCESS_READ; rn GenericMapping.GenericWrite = ACCESS_WRITE; rn GenericMapping.GenericExecute = 0; rn GenericMapping.GenericAll = ACCESS_READ | ACCESS_WRITE; rnrn if (!AccessCheck(psdAdmin, hToken, dwAccessDesired, rn &GenericMapping, &ps, &dwStructureSize, &dwStatus, &bReturn)) rn goto LeaveIsAdmin; rnrn if(!RevertToSelf()) rn bReturn = FALSE; rnrnLeaveIsAdmin: rnrn if (pACL) LocalFree(pACL); rn if (psdAdmin) LocalFree(psdAdmin); rn if (psidAdmin) FreeSid(psidAdmin); rnrn return bReturn; rnrnrn[/code]
这段代码如何解释呢?
[code=JScript] rn rnrn 最新公告rn 网站正式开通!rnrn rn rn rn rn [/code]
怎样解释这段代码呢?
<%rnset rs=server.CreateObject("ADODB.RecordSet")rnrs.Source="select * from BigClass order by BigClassID"rnrs.Open rs.Source,conn,1,1rni=1rnDim ArrayBigClassID(20),ArrayBigClassName(20),ArrayBigClassView(20)rnif not rs.EOF thenrnrseof=1rnend ifrnwhile not rs.EOFrnRecordCount=rs.RecordCountrnBigClassView=rs("BigClassView")rnBigClassID=rs("BigClassID")rnBigClassName=trim(rs("BigClassName"))rnrnrnTdString="" & BigClassName & ""rnResponse.Write TdStringrnArrayBigClassView(i)=BigClassViewrnArrayBigClassID(i)=BigClassIDrnArrayBigClassName(i)=BigClassNamernrni=i+1rnrnrs.MoveNextrnwendrnrs.closernrn%>rnrnrnrn能否把这段代码用C#写出来呢
mysql 1064错误,第二行和第三行
第二行和第三行哪里出错了?nCREATE TABLE IF NOT EXISTS CardInfo(n cardID CHAR(16)NOT NULL PRIMARY KEY COMMENT'卡号',n curID VARCHAR(5)NOT NULL DEFAULT RMB COMMENT'货币种类',n savingID INT NOT NULL COMMENT'存款类型',n openDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP()COMMENT'开户日期',n openMoney DECIMAL(M,D) NOT NULL COMMENT'开户金额',n balance DECIMAL(M,D)NOT NULL COMMENT'余额',n `password` VARCHAR(6) NOT NULL DEFAULT 888888 COMMENT'密码',n isReportLoss TINYINT NOT NULL DEFAULT 0 COMMENT'是否挂失',n customerID INT NOT NULL COMMENT'客户编号'n n n)COMMENT='银行卡信息表';
批处理获取文件倒数第三行
@echo off&amp;amp;setlocal enabledelayedexpansion (for %%a in (*.txt) do ( for /f &quot;usebackq delims=&quot; %%b in (&quot;%%a&quot;) do ( set &quot;str2=!str1!&quot; set &quot;str1=!str!&quot; set &quot;str=%%b&quot; ) if define..
求大佬解释,我这段代码哪错了
[code=c]#includernusing namespace std;rnrnstruct student rnrn int num;rnrn char name[10];rnrn int score1;rnrn int score2;rnrn int score3;rnrn float aver;rn;rnrnvoid main()rnrn void input(struct student stu[]);rnrn void scoresort(struct student stu[]);rn rn void output(struct student stu[]);rnrn struct student stu[3],*p=stu;rnrn input(p);rnrn scoresort(p);rnrn output(p);rn rnrnrnvoid input(struct student stu[])rnrn int i;rnrn printf("NUM\tNAME\tSCORE1\tSCORE2\tSCORE3\n");rnrn for(i=0;i<3;i++)rnrn rnrn scanf("%d%s%d%d%d",&stu[i].num,stu[i].name,&stu[i].score1,&stu[i].score2,&stu[i].score3);rnrn stu[i].aver=(stu[i].score1+stu[i].score2+stu[i].score3)/3;rnrn rnrn printf("\n");rn rn cout<<"Before Sort:"<stu[k].aver) k=j;rn rn if(k!=i)rn rn rn p=stu[i];stu[j]=stu[k];stu[k]=p;rn rnrn rn rnrnrnvoid output(struct student stu[])rnrnrn int i; rn rn cout<<"After Sort:"<
这段代码结果是怎么得到的,求解释???
package mainrnrnimport "fmt"rnrnfunc main() rn a := uint16(65000) rn b := int16(a)rn fmt.Println(b)rnrnrn输出: -536rn
这段表达式怎么解释呢?
<%= “4” + “2” %> rn它会输出什么?rn那有没有<%= 4 + 2 %>
求教导怎么优化算法
只是第1,2次选择。还要再做2次。后面基本一样重复第二次志愿的。100个学生运行数据大概花了6-7秒。求指导怎么可以优化下~~谢谢rnrnrnif($_POST['cal'])rn rn //--------------------------------------------第一志愿-------------------------------------------rn $sql = "select * from hos;";rn $res = mysql_query($sql)or die(mysql_error());rn $info = mysql_fetch_array($res)or die(mysql_error()); rn //echo $info['total']; //得到总医院数rn do //循环1rn // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//分界线rn if($info['same']==0) //如果不分男女时rn rn $hos_id = $info['id']; //医院ID号rn //echo $hos_id.",";rn $hos_total = $info['total']; //医院总需求人数rn //echo $hos_total.".";rn $sql_total = "select count(*) as total from stu where first='".$hos_id."' and get=0 ;"; //添该志愿的学生数rn $res_total = mysql_query($sql_total);rn $info_total = mysql_fetch_array($res_total); //得到填报该志愿的学生数rn if($hos_total > $info_total['total'])rn $sql1 = "select id from stu where first='".$hos_id."' and get=0 ORDER BY score DESC ;";rn else $sql1 = "select id from stu where first='".$hos_id."' and get=0 ORDER BY score DESC limit $hos_total;";rn $res1 = mysql_query($sql1);rn $info1 = mysql_fetch_array($res1);rn do //循环2rn rn $stu_id = $info1['id'];rn $sql2 = "UPDATE stu SET result='".$hos_id."',get=1 where id='".$stu_id."' ;";rn $res2 = mysql_query($sql2); rn while($info1 = mysql_fetch_array($res1)); //循环2结束rn rn // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//分界线rnrn else //如果区分男女-----$info['same']==1;rn rn $hos_id = $info['id']; //医院ID号rn //男生SQLrn $hos_total_men = $info['men']; //医院总需求男生数rn $sql_total_men = "select count(*) as total_men from stu where first='".$hos_id."' and sex='f' and get=0 ;"; //添该志愿的男学生数rn $res_total_men = mysql_query($sql_total_men);rn $info_total_men = mysql_fetch_array($res_total_men); //得到填报该志愿的男学生数rn if($hos_total_men > $info_total_men['total_men'])rn $sql1_men = "select id from stu where first='".$hos_id."' and sex='m' and get=0 ORDER BY score DESC ;";rn else $sql1_men = "select id from stu where first='".$hos_id."'and sex='m' and get=0 ORDER BY score DESC limit $hos_total_men;";rn $res1_men = mysql_query($sql1_men);rn $info1_men = mysql_fetch_array($res1_men);rn do //循环2rn rn //男生更新rn $stu_id_men = $info1_men['id'];rn $sql2_men = "UPDATE stu SET result='".$hos_id."',get=1 where id='".$stu_id_men."' ;";rn $res2_men = mysql_query($sql2_men); rn while($info1_men = mysql_fetch_array($res1_men));rn //女生SQLrn $hos_total_wom = $info['wom']; //医院总需求女生数rn $sql_total_wom = "select count(*) as total_wom from stu where first='".$hos_id."' and sex='f' and get=0 ;"; //添该志愿的男学生数rn $res_total_wom = mysql_query($sql_total_wom);rn $info_total_wom = mysql_fetch_array($res_total_wom); //得到填报该志愿的女学生数rn if($hos_total_wom > $info_total_wom['total_wom'])rn $sql1_wom = "select id from stu where first='".$hos_id."' and sex='f' and get=0 ORDER BY score DESC ;";rn else $sql1_wom = "select id from stu where first='".$hos_id."' and sex='f' and get=0 ORDER BY score DESC limit $hos_total_wom;";rn $res1_wom = mysql_query($sql1_wom);rn $info1_wom = mysql_fetch_array($res1_wom);rn do //循环2rn rn //女生更新rn $stu_id_men = $info1_wom['id'];rn $sql2_wom = "UPDATE stu SET result='".$hos_id."',get=1 where id='".$stu_id_wom."';";rn $res2_wom = mysql_query($sql2_wom); rn while($info1_wom = mysql_fetch_array($res1_wom));rn //循环2结束rn rnrn while($info = mysql_fetch_array($res)); //循环1结束rn //--------------------------------------------第一志愿结束-------------------------------------------rnrnrnrn //----------------------------------------------第二志愿---------------------------------------------rn $s_sql = "select * from hos;";rn $s_res = mysql_query($s_sql)or die(mysql_error());rn $s_info = mysql_fetch_array($s_res)or die(mysql_error()); rn do //循环1rn // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//分界线rn if($s_info['same']==0) //如果不分男女时rn rn $s_hos_id = $s_info['id']; //医院ID号rn $s_hos_total = $s_info['total']; //医院总需求人数rn $s_sql_total = "select count(*) as total from stu where second='".$s_hos_id."' and get=0 ;"; //添该志愿的学生数rn $s_res_total = mysql_query($s_sql_total);rn $s_info_total = mysql_fetch_array($s_res_total); //得到第二志愿填报该志愿的学生数rn $s_get_sql = "select count(*) as total from stu where result='".$s_hos_id."' ;"; //得到第一志愿已为HOS_ID的学生rn $s_get_res = mysql_query($s_get_sql);rn $s_get_info = mysql_fetch_array($s_get_res); rn if($s_get_info['total'] == $s_hos_total)rn elsern rn $xuqiu2 = $s_hos_toal-$s_get_info['total']; //还需要多少学生数rn if( $xuqiu2 > $s_info_total['total'])$s_sql1 = "select id from stu where second='".$s_hos_id."' and get=0 ORDER BY score DESC ;";rn else $s_sql1 = "select id from stu where second='".$s_hos_id."' and get=0 ORDER BY score DESC limit $xuqiu2;";rn $s_res1 = mysql_query($s_sql1);rn $s_info1 = mysql_fetch_array($s_res1);rn do //循环2rn rn $s_stu_id = $s_info1['id'];rn $s_sql2 = "UPDATE stu SET result='".$s_hos_id."',get=1 where id='".$s_stu_id."' ;";rn $s_res2 = mysql_query($s_sql2); rn while($s_info1 = mysql_fetch_array($s_res1));rn rn //循环2结束rn rnrnrn else //如果区分男女-----$info['same']==1;rn rn $s_hos_id = $s_info['id']; //医院ID号rn //男生SQLrn $s_hos_total_men = $s_info['men']; //医院总需求男生数rn $s_sql_total_men = "select count(*) as total_men from stu where second='".$s_hos_id."' and sex='m' and get=0 ;"; //添该志愿的男学生数rn $s_res_total_men = mysql_query($s_sql_total_men);rn $s_info_total_men = mysql_fetch_array($s_res_total_men); //得到填报该志愿的男学生数rnrn $s_get_sql_men = "select count(*) as total from stu where result='".$s_hos_id."' and sex='m' ;"; //得到第一志愿已为HOS_ID的男学生rn $s_get_res_men = mysql_query($s_get_sql_men);rn $s_get_info_men = mysql_fetch_array($s_get_res_men); rn if($s_get_info_men['total'] == $s_hos_total_men)rn elsern rn $xuqiu2_men = $s_hos_toal_men-$s_get_info_men['total']; //还需要多少男学生数rn if($xuqiu2_men > $s_info_total_men['total_men'])rn $s_sql1_men = "select id from stu where second='".$s_hos_id."' and sex='m' and get=0 ORDER BY score DESC ;";rn else $s_sql1_men = "select id from stu where second='".$s_hos_id."'and sex='m' and get=0 ORDER BY score DESC limit $xuqiu2_men;";rn $s_res1_men = mysql_query($s_sql1_men);rn $s_info1_men = mysql_fetch_array($s_res1_men);rn do //循环2rn rn //男生更新rn $s_stu_id_men = $s_info1_men['id'];rn $s_sql2_men = "UPDATE stu SET result='".$s_hos_id."',get=1 where id='".$s_stu_id_men."' ;";rn $s_res2_men = mysql_query($s_sql2_men); rn while($s_info1_men = mysql_fetch_array($s_res1_men));rn rnrn rn //女生SQLrn $s_hos_total_wom = $s_info['wom']; //医院总需求女生数rn $s_sql_total_wom = "select count(*) as total_wom from stu where second='".$s_hos_id."' and sex='f' and get=0 ;"; //添该志愿的女学生数rn $s_res_total_wom = mysql_query($s_sql_total_wom);rn $s_info_total_wom = mysql_fetch_array($s_res_total_wom); //得到填报该志愿的女学生数rnrn $s_get_sql_wom = "select count(*) as total from stu where result='".$s_hos_id."' and sex='f' ;"; //得到第一志愿已为HOS_ID的女学生rn $s_get_res_wom = mysql_query($s_get_sql_wom);rn $s_get_info_wom = mysql_fetch_array($s_get_res_wom); rn if($s_get_info_wom['total'] == $s_hos_total_wom)rn elsern rn $xuqiu2_wom = $s_hos_toal_wom-$s_get_info_wom['total']; //还需要多少女学生数rn if($xuqiu2_wom > $s_info_total_wom['total_wom'])rn $s_sql1_wom = "select id from stu where second='".$s_hos_id."' and sex='f' and get=0 ORDER BY score DESC ;";rn else $s_sql1_wom = "select id from stu where second='".$s_hos_id."'and sex='f' and get=0 ORDER BY score DESC limit $xuqiu2_wom;";rn $s_res1_wom = mysql_query($s_sql1_wom);rn $s_info1_wom = mysql_fetch_array($s_res1_wom);rn do //循环2rn rn //女生更新rn $s_stu_id_wom = $s_info1_wom['id'];rn $s_sql2_wom = "UPDATE stu SET result='".$s_hos_id."',get=1 where id='".$s_stu_id_wom."' ;";rn $s_res2_wom = mysql_query($s_sql2_wom); rn while($s_info1_wom = mysql_fetch_array($s_res1_wom));rn rnrnrnrn rnrnrnrn while($info = mysql_fetch_array($res));
jquery 怎样删除表格倒数第三行,和在倒数第二行上面插入一行
jquery 怎样删除表格倒数第三行,和在倒数第二行上面插入一行rn[code=html]rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrn
求高手解释下这段代码
代码详见:http://www.2cto.com/kf/201111/111182.htmlrn是一段C语言的俄罗斯方块,其中main()里面有这么一段(最下面):rnrnkey=getch(); rn rn if(key1==-32 && key==72) rn rn int tmp=id; rn rn id++; rn rn if( id%4==0 && id!=0 )id=id-4; rn rn if(judge_in(cur_x,cur_y,id)!=1)id=tmp; rn rn rn rn else if(key1==-32 && key==80 && judge_in(cur_x+1,cur_y,id)==1)cur_x++; rn rn else if(key1==-32 && key==75 && judge_in(cur_x,cur_y-1,id)==1)cur_y--; rn rn else if(key1==-32 && key==77 && judge_in(cur_x,cur_y+1,id)==1)cur_y++; rn rn else if(key==27)return 0; rn rn key1=key; rn我的问题是,除了引用段之外,没有代码还涉及key和key1两个变量,引用代码中是如何让key1的值为-32的呢?我看了好久都没懂。。。。求指教啊。。
求大神解释下这段代码
[code=javascript]rnvar context = context || rn put:function (key, value) rn session.put(key, value);rn ,rn get:function (key) rn return session.get(key);rn ,rn remove:function (key) rn session.remove(key);rn rn;rn[/code]
这段代码什么意思求解释
#include n#include n#include n#include nnn//Constantsn#define LINELENGTH 100nnn// Function prototypesnvoid reverse_words(char* words[], char* rwords[], int count);nvoid print_words(char* words[]);nint mark_words(char* line, char* words[]);nnn// Main Functionnint main( void )nn char *line; n char *words[51];n char *rwords[51];n int count;nn if(( line = (char*) malloc(LINELENGTH * sizeof(char))) == NULL ) n return 1;n n strcpy(line, "this is a sample line to be broken into words.");nn count = mark_words( line, words );n n reverse_words( words, rwords, count );nn print_words( rwords );nn return 0;nnn/*n Converts line to a packed string of words and putsn pointers to each word in words[].n n returns the number of words it found.n*/nint mark_words( char* line, char* words[] )nn int i, count = 1;n char inbetween = 0;nn words[0] = line;n for( i=0; line[i] != 0 ; ++i ) n if( isspace( line[i] )) n inbetween = 1;n line[i] = '\0';n n else // i.e. line[i] is not a whitespace charactern if( inbetween ) n inbetween = 0;n words[count++] = line + i;n n n n words[count] = NULL;n return count;nnn/*n Copies the pointers in words[] to rwords[] in reverse order.n count is the number of pointers in words[]n*/nvoid reverse_words( char* words[], char* rwords[], int count )nn int j = 0;nn for( j = 0; words[j] != '\0'; j++ ) n rwords[j] = words[count-j-1];n n rwords[j] = '\0';nnn/*n Prints each word in words[] to stdout in order and preceded by its number.n*/nvoid print_words( char* words[] )nn int k;nn for( k=0; words[k] != 1; k++ ) n printf("%2d. %s\n", k+1, words[k]);n nn
这段 代码求解释啊
#includernint main()rnrn char str1[1000],*p1=str1;rn int a[1000],*p2=a,ks=0,n=0,l,i;rn gets(str1);rn while(*p1++)rn rn if(ks==0&&*(p1-1)>='0'&&*(p1-1)<='9')rn ks=1;rn if(ks==1&&(*(p1-1)<'0'||*(p1-1)>'9'))rn ks=0;rn if(ks&&*(p1-1)>='0'&&*(p1-1)<='9')rn *p2++=*(p1-1)-'0';rn if(ks&&(*(p1-1)>='0'&&*(p1-1)<='9')&&(*p1<'0'||*p1>'9'))rn rn *p2++=10;rn n++;rn rn if(*p1==0)rn *p2=*p1;rn rn l=p2-a-1;rn printf("%d\n",n);rn for(i=0;i
求大神解释这段代码??
function log()rn console.log.apply(console, arguments);rn;rnlog(1); //1rnlog(1,2); //1 2rnrn
求解释这段if判断代码
MessageBox.Show("初始为"+splitContainer1.Panel1Collapsed.ToString());rn if (!splitContainer1.Panel1Collapsed)rn rn this.splitContainer1.Panel1Collapsed = true;rn MessageBox.Show("if里" + splitContainer1.Panel1Collapsed.ToString());rn btn1.Text = "展开面板一";rn rn elsern rn this.splitContainer1.Panel1Collapsed = false;rn MessageBox.Show("else里" + splitContainer1.Panel1Collapsed.ToString());rn btn1.Text = "收缩面板一";rn rn MessageBox.Show("最后为"+splitContainer1.Panel1Collapsed.ToString());rnrnsplitContainer1.Panel1Collapsed的默认值为falsern问题一: if (!splitContainer1.Panel1Collapsed) 这个意思是不是“如果非false就不执行”rn问题二:当第二次的时候splitContainer1.Panel1Collapsed的值已经变成true了,为什么不执行if语句块
jquery 怎么查找表格的倒数第二行
// 设置最后一行的宽度rn DATA_TABLE_COLS_LAST_WIDTH = ["610px", "80px", "80px", "80px"];rn rn $("#tbData").find("tr:last").find("td").each(function(i)rn if(DATA_TABLE_COLS_LAST_WIDTH[i]) $(this).css("width", DATA_TABLE_COLS_LAST_WIDTH[i]);rn );rnrn我现在想固定倒数第二行的宽度,不知怎么写,请大家帮忙.
求大佬解释下 急
随机产生0~100之间的随机整数,如果是3的倍数,就把该数显示在页面,如果产生的是0,就结束产生随机数,并在页面利用警告框提示“共产生???个随机数,其中3的倍数有?个!”。rn这个问题用javascript+jquery怎么写
求大佬强行解释
我Fragment中rn调用相册选好图片返回的时候rnphotoAdapter.notifyDataSetChanged();rn没反应rnlist里面已经取到值了rn拖动一下后我的recyclerview才会刷新出来图片rn请问这个怎么解决 各位大佬
求大佬解释
C/C++中puth push 这两个输出函数的区别
看看这段代码怎么解释 ?
static int ALIGN(int x, int y) rn // y must be a power of 2.rn return (x + y - 1) & ~(y - 1);rn
C++读 文件 倒数第二行
#include #include #include using namespace std; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); char aa[4][50]; // memcpy(aa,0,200); int TeachOrder,order;
怎样得到倒数第二行的数据?
我只想得出表中以日期排序(倒序)后的第二条记录,请问怎样实现?
帮我解释下这段代码吧,谢谢了
rnrnrn我想不通为什么输出的是“xiaobai”,应该是“xiaohei”吧。
read()方法返回int???
read()方法读取的是byte字节,返回的是int,那么返回值有没有可能是255,如果可能,那么它对应的应该表示读取时读到的是byte类型的-1。所以为了区分与读到文件末尾返回的-1,所以设置返回值类型为int(int低八位)。rnrn问题是:文件转换的二进制数据,以每次读取八位来看,值的范围是-128到127吗?
求解释c++代码是怎么实现的
#include rnusing namespace std;rnint c1[1000];rnint c2[1000];rnint main ()rnrn int n,i,j,k;rn while (cin>>n)rn rn for(i=0;i<=n;i++)rn rn c1[i]=1;rn c2[i]=0; rn rn for(i=2;i<=n;i++)rn rn for(j=0;j<=n;j++)rn rn for(k=0;k+j<=n;k+=i) rn c2[j+k]+=c1[j]; rn rn for(j=0;j<=n;j++)rn rn c1[j]=c2[j];rn c2[j]=0;rn rn rn cout<
求教导
>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxwin.h(27) : fatal error C1189: #error : Your version of the Windows SDK is earlier than 6.0. Try setting the 'WINVER' and '_WIN32_WINNT' definitions in your project to less than 0x0600.
这段代码是啥意思呢
function gv_cnzz(of)var es=document.cookie.indexOf(";",of);if(es==-1)es=document.cookie.length;return unescape(document.cookie.substring(of,es))function gc_cnzz(n)var arg=n+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i500*86400)&&(cnzz_lt>0))cnzz_rt++;cnzz_data=cnzz_data+'&repeatip='+cnzz_a+'&rtime='+cnzz_rt+'&cnzz_eid='+escape(cnzz_eid)+'&showp='+escape(screen.width+'x'+screen.height)+'&st='+cnzz_st+'&sin='+escape(cnzz_sin.substr(0,512))+'&res=0';document.write('');document.write('');var cnzz_et=(86400-cnzz_ed.getHours()*3600-cnzz_ed.getMinutes()*60-cnzz_ed.getSeconds());cnzz_ed.setTime(cnzz_now+1000*(cnzz_et-cnzz_ed.getTimezoneOffset()*60));document.cookie="cnzz_a5342346="+cnzz_a+";expires="+cnzz_ed.toGMTString()+"; path=/";document.cookie="sin5342346="+escape(cnzz_sin)+";expires="+cnzz_ed.toGMTString()+";path=/";cnzz_ed.setTime(cnzz_now+1000*86400*182);document.cookie="rtime="+cnzz_rt+";expires="+cnzz_ed.toGMTString()+";path=/";document.cookie="ltime="+cnzz_now+";expires="+cnzz_ed.toGMTString()+";path=/";document.cookie="cnzz_eid="+escape(cnzz_eid)+";expires="+cnzz_ed.toGMTString()+";path=/";
关于read()读取的方法
请问read()不是读取下一个字节吗 ,它的返回值是int类型的,那为什么在system.out.print(b);可以输出读取的字节,rn这一点心我定义了int b=input.read()把的返回值给b了;
相关热词 c# login 居中 c# 考试软件 c# 自然语言分析 c# 分段读取文件 c# 泛型反射 c#打断点 c# 时间转多少秒 c# 线程函数加参数 c# modbus 读取 c#查询集合表