PTA提交一个用C语言写的程序 出现段错误,帮忙看看是哪的问题。谢谢

#include

int m, n;

int main()
{
int h_l[10];
int i, j, pos_i = 0, pos_j = 0;
int h_i = 0, len = 0;
while (1)
{
int L[10][10];
int min = 65535;
if ((scanf("%d %d", &m, &n)) == 2) //输入数据
{
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
{
if ((scanf("%d", &L[i][j])) == 1)
;
else
break;
}
}
}
else
break;

    if (m == 0 && n == 0)
        break;

    for (i = 0; i < m; i++)
    {
        for ( j = 0; j < n; j++)
        {
            if (L[i][j]<min)
            {
                min = L[i][j];
                pos_i = i;
                pos_j = j;
            }
        }
        if (min == 0)
            break;
    }
    len++;
    h_l[h_i] = pos_i;
    h_l[h_i + 1] = pos_j;
}

for (int k = 0; k < len; k = k + 2)
    printf("%d %d\n", h_l[k] + 1, h_l[k + 1] + 1);

return 0;

}

c

5个回答

m和n会不会大于10了,那样超过你数组的容量,越界就会出现段错误。

qq_37996584
CHN_WZY2121_yuyu 我输入的m和n都是8,没有大于10
接近 2 年之前 回复

h_l[h_i] = pos_i;
h_l[h_i + 1] = pos_j;
这里下标会不会越界呢。

qq_37996584
CHN_WZY2121_yuyu 我在VS上运行是可以的,是提交PTA的时候才出现段错误。这里的下标也没越界啊
接近 2 年之前 回复

谢谢帮忙,问题我通过把数组大小改大解决了。虽然之前都没有越界。

if (m == 0 && n == 0)
break;

for (i = 0; i < m; i++)
{
    for ( j = 0; j < n; j++)
    {
        if (L[i][j]<min)
        {
            min = L[i][j];
            pos_i = i;
            pos_j = j;
        }
    }
    if (min == 0)
        break;
}
len++;
h_l[h_i] = pos_i;
h_l[h_i + 1] = pos_j;

}

for (int k = 0; k < len; k = k + 2)
printf("%d %d\n", h_l[k] + 1, h_l[k + 1] + 1);

return 0;

在while循环中,你的h_i值一直是0 ,
当你while循环差过10次之后, len > 10 下面的for循环中h_l[k + 1]会超过10
for (int k = 0; k < len; k = k + 2)
printf("%d %d\n", h_l[k] + 1, h_l[k + 1] + 1);

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
帮忙看看是哪错了
下面是代码及错误提示,帮忙改改,我实在是没辙了。看不懂错误提示。rnrn--------------------Configuration: feifei - Win32 Debug--------------------rnCompiling...rn指针连接字符串.crnE:\三级\my project\feifei\指针连接字符串.c(9) : warning C4013: 'strlen' undefined; assuming extern returning intrnE:\三级\my project\feifei\指针连接字符串.c(16) : error C2143: syntax error : missing ';' before 'type'rnE:\三级\my project\feifei\指针连接字符串.c(19) : error C2143: syntax error : missing ';' before 'type'rnE:\三级\my project\feifei\指针连接字符串.c(20) : error C2143: syntax error : missing ';' before 'type'rnE:\三级\my project\feifei\指针连接字符串.c(23) : error C2065: 'ch' : undeclared identifierrnE:\三级\my project\feifei\指针连接字符串.c(23) : error C2065: 's1' : undeclared identifierrnE:\三级\my project\feifei\指针连接字符串.c(23) : error C2100: illegal indirectionrnE:\三级\my project\feifei\指针连接字符串.c(28) : error C2065: 's2' : undeclared identifierrnE:\三级\my project\feifei\指针连接字符串.c(28) : error C2100: illegal indirectionrnE:\三级\my project\feifei\指针连接字符串.c(29) : error C2100: illegal indirectionrnE:\三级\my project\feifei\指针连接字符串.c(29) : error C2106: '=' : left operand must be l-valuernE:\三级\my project\feifei\指针连接字符串.c(31) : error C2065: 'dest' : undeclared identifierrnE:\三级\my project\feifei\指针连接字符串.c(33) : error C2059: syntax error : ''rn执行 cl.exe 时出错.rnrnfeifei.exe - 1 error(s), 0 warning(s)rnrnrn#includern#includernchar*strCat(register char*dest,register const char*src);rnint main(void)rnrn char strDest[161]="you are";rn char strName[81];rn puts("please enter your name:");rn while((strlen(strDest)<80) && strlen(gets(strName)))rn rn strCat(strDest,strName);rn printf("%s\n",strDest);rn system("pause");rn return 0;rn rn char*strCat(register char*dest,register const char*src)rn rn register char*s1=dest;rn register const char*s2=src;rn register char ch;rn dorn rn ch=*s1++;rn while(ch!='\0');rn s1-=2;rn dorn rn ch=*s2++;rn *++s1=ch;rn while(ch!='\0');rn return dest;rn rnrn
帮忙看看是 错哪了~
rn做登录~~~错误了 要弹出对话框提示~~~提示后仍然可以继续跳转到登录页面rnrnrnint count = 0; rnwhile (1) rn rn CLoginDlg dlg(this); rn if (dlg.DoModal() == IDOK) rn rn if (用户名&&密码) rn break; rn else rn rn count++; rn if (count > 3) rn //次数太多,退出 rn rn rn rn rn rn
帮忙看看是哪出问题了 ?
typedef struct Nodernrn int val;rn struct Node *next;rnNode,*Link;rnrnNode *PriorElem(Link L,Node *t)rn /*L是单连表的头指针*/rn Node *p=L;rn Node *q=p->next; rn while(q!=t||q)rn rn *p=q;rn q=q->next;rn rn return p;rnrnrn上面的函数想找到并返回t的前驱的指针。但在具体问题中并不能做到这点rn不知道这个函数错在哪了?
帮忙看看是哪出了问题!
#include rnrnvoid insert_re(int *result,int &count,int tmp)rnfor(int i=0;i
各位帮忙看看是哪出错了。。。。
用Java 写一个乘法表如图所示,要求part one 使用一个while循环 part two 使用for嵌套循环rn 1 2 3 4 5 6 7 8 9rn1 1 2 3 4 5 6 7 8 9rn2 2 4 6 8 10 12 14 16 18rn3 3 6 9 12 15 18 21 24 27rn4 4 8 12 16 20 24 28 32 36rn5 5....rn6 ....rn7 ....rn8 ....rn9 ...rn我已经写了一个不过那上下对不齐。。。rn各位帮我看看是哪出错了。。。。rnpublic class MultiTestrn public static void main(String[] args)rn int i = 1,j = 1;rn System.out.print(" MultiTest Table "+"\n");rn System.out.print("---------------------"+"\n");rn System.out.print(" ");rn while(i <= 9)rn rn System.out.print(i + " ");rn //i++;rn for(i = 1;i < 9;i++)rn rn System.out.println(i);rn for(j = 1;j <= 9;j++)rn rn System.out.print(i * j + " ");rn rn rn i++;rn rn //System.out.println();rn /*for(i = 1;i <= 9;i++)rn rn System.out.println(i);rn for(j = 1;j <= 9;j++)rn rn System.out.print(i * j + " ");rn rn */rn rn
各位帮忙看看是哪错了!急死人了!
cmd.CommandText="select id as cc from companytable where LoginName=@bm";rncmd.Parameters.Add("@bm",Session["LoginName"]);rn rnSqlDataReader dr=cmd.ExecuteReader();rnrnif (dr.Read())rn rnif ((Int64.Parse(dr["cc"].ToString())<100))rnrnLabelsw.Text=dr["cc"].ToString()+ "1000001";rnrnelsernrnLabelsw.Text=(Int64.Parse(dr["cc"].ToString())).ToString();rnrnrndr.Close(); rn//上面是获取id rncmd.CommandText="updata companytable set CoName='"+TextBoxsw1.Text+"'where id = '"+Labelsw.Text+"'";rnrncmd.ExecuteNonQuery();rnconn.Close();rn提示: 第 1 行: 'updata' 附近有语法错误。 rn行 637: cmd.ExecuteNonQuery();rn
大家帮忙看看是哪的错啊?
以下程序是实现按用户的选择把数据库中的数据进行排序,之后再显示到页面上,我用switch函数是不是不行啊?还是我用的不对啊?请指教下,我刚学一周,很多函数还不是很了解,请各位高手指点指点~!先谢过~!rnrnrnrnrn MySQL開発支援ツールrn MySQL開発支援ツールrn rnrn rn MySQL開発支援ツールTEST01rn rn Please choice the order type:rn rn please choice...rn namern IDrn malern famalern rn rn rn rn";rn rn mysql_close($connect);rn?>rnrn rn
请帮忙看看是哪错了
我想做的是删除数据库表dp里面的dp_tubiao列的内容和相应的文件夹dp里面的图片,在使用的时候报错rnMicrosoft VBScript 运行时错误 错误 '800a01a8' rnrn缺少对象: 'conn' rnrn/glpt/glpt_dpgl_deltubiao.asp,行9 rn请高手帮忙看看是哪错了,如果我做错了,请帮我改下,或者给个现成的。嘿嘿。rn源码如下:rnglpt_dpgl_deltubiao.asprnrn<%@LANGUAGE="VBSCRIPT"%>rnrn<%rnid=request.querystring("id")rnif id="" thenrn response.write "参数不足"rn response.endrnend ifrnimg=conn.execute("select ../8182tpj/dp from dp set dp_tubiao where id='"&id&"'")("../8182tpj/dp")rnsql="delete * from product set dp_tubiao where id='"&id&"'"rnconn.execute sqlrndim fso :set fso=server.createobject("scripting.filesystemobject")rnpath=server.mappath("../8182tpj/dp")rnif fso.fileexists(path&"\"&img) then fso.deletefile path&"\"&img rnset fso=nothingrnif not err thenrn response.write "删除成功!退回上一步"rnelsern response.redirect "javascript:history.go(-1)"rnend ifrn conn.closern set conn=nothingrn%>
请帮忙看看是哪出错了。谢谢
我做了个记录集,可是不能把比当前时间大的记录提取出来,例如到期的广告不能显示或者不到期的广告能显示。总出错,高手帮忙看看rn当and shijian > #" + Replace(shijian, "'", "''") + "#",conn,1,3 中=时能够显示出当前时间的记录,可是换成>或者rnrn<%rn'////////////////创建记录集的过程rndim tiaojian,shouru,shijian ' 定义tiaojian和shouru两个条件变量,用于记录集的条件显示rntiaojian= Session("MM_Username") ' tiaojian的变量为登陆用户rnIf (Session("MM_Username") <> "") Then ' 判断登陆用户是否为空,不为空则显示rn tiaojian = Session("MM_Username") 'tioajian变量的值等于登陆用户rn else '为空则显示rn Response.Write("违反感到风格风格") '为空显示的内容rnEnd If '判断完成rnshouru="收入" 'shouru变量的值rnshijian=date() '定义比较的时间为当前时间rn'///////////////////rnset rs=server.CreateObject("adodb.recordset") '创建一个rs的记录集rnrs.open"select leibie,jine,shijian from weibi where zhanghu ='" + Replace(tiaojian, "'", "''") + "' and leibie='" + Replace(shouru, "'", "''") + "' and shijian > #" + Replace(shijian, "'", "''") + "#",conn,1,3 '记录集打开表weibi中leibie、jine和两个字段,条件是上面定义的tiaojian、shouru和shijian两个变量,其中" + Replace(tiaojian, "'", "''") + "就是tiaojian两面用''包围rn%>rn<%rnDim Repeat1__numRowsrnDim Repeat1__indexrnrnRepeat1__numRows = -1rnRepeat1__index = 0rnrs_numRows = rs_numRows + Repeat1__numRowsrn%>rnrnrnrnrn rn 记录集实验-创建记录集rnrnrnrn<% rnWhile ((Repeat1__numRows <> 0) AND (NOT rs.EOF)) rn%>rn rn rn <%=rs("leibie")%>rn <%=rs("jine")%>rn <%=shijian%>rn rnrn<% rn Repeat1__index=Repeat1__index+1rn Repeat1__numRows=Repeat1__numRows-1rn rs.MoveNext()rnWendrn%>rnrnrn<%rnrs.closernset rs=nothingrn%>
PTA——段错误
在PTA上做题,做出来个段错误,一查吓一跳,发篇博客冷静下。(#^.^#) 1076 Wifi密码 (15 分) 下面是微博上流传的一张照片:“各位亲爱的同学们,鉴于大家有时需要使用 wifi,又怕耽误亲们的学习,现将 wifi 密码设置为下列数学题答案:A-1;B-2;C-3;D-4;请同学们自己作答,每两日一换。谢谢合作!!~”—— 老师们为了促进学生学习也是拼了…… 本题就要求你写程序把...
一个程序出现段错误,帮忙看一下。
函数功能是将源字符串(域名)用.分割,返回倒数第二个字串。rn到了语句 strcpy(arr[j],token);就出现段错误,怎么回事阿?rnrnvoid parse_name(char *sour,char *dest)rn rnchar seps[] = ".";rnchar *token;rnint j=0;rnchar *arr[10];rn token = strtok( sour, seps );rn while( token != NULL )rn rn arr[j]=(char *)malloc(512);rn strcpy(arr[j],token);rn j++;rn token = strtok( NULL, seps );rn rn dest=arr[j-2];rnrn
c语言问题(段错误)
字符串s1中出现类似"a-f"这样的在字符串中展开为“abcdef",rn我只是编写了对小写字母有用的程序rn输出的时候,a-y可以展开,可是只要出现z就提示”段错误“rnrn代码:rn//head.hrnrn#ifndef __HEAD_Hrn#define __HEAD_Hrnint search(char);rnvoid expand(char *,char*);rn#endifrnrnrn//main.crn#includern#include"head.h"rn#define MAX 200rnchar small[26]='a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',rn 'p','q','r','s','t','u','v','w','x','y','z';rnint main()rnrn char s1[MAX],s2[MAX],ch;rn int i=0;rn printf("please input a string:\n");rn while((ch=getchar())!=EOF)rn rn s1[i]=ch;rn i++;rn rn s1[i]='\0';rn expand(s1,s2);rn printf("\n%s\n",s2);rn return 0;rnrnrnrnrn//expand.crnextern char small[26];rnvoid expand(char *s1_ptr,char *s2_ptr)rnrn char *current=s1_ptr;rn int i;rn while((*current)!='\0')rn rn if((*current>='a')&&(*current<='z'))rn rn if((*(current+1)=='-')&&((*(current+2)>='a')&&(*(current+2)<='z')))rn rn i=search(*current);rn while(small[i]<=*(current+2))rn rn *s2_ptr=small[i];rn i++;rn s2_ptr++;rn rn current=current+3;rn rnrn rn elsern rn *s2_ptr=*current;rn s2_ptr++;rn current++;rn rn rn *s2_ptr='\0';rnrnrnrnrn//search.hrnrnextern char small[26];rnint search(char ch)rnrn int i=0;rn for(;i<26;i++)rn rn if(ch==small[i])rn return i;rn rnrnrnrn希望大家给我解释一下,现在搞不明白,不知道怎么修改
帮忙看看是哪有问题,
我的页面上当点击查询时报如下错误,那位能给点提示rnrnrntype Exception reportrnrnmessage Internal Server Errorrnrndescription The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.rnrnexception rnrnjavax.servlet.ServletException: Error allocating a servlet instancern at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:659)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)rn at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)rn at java.lang.Thread.run(Thread.java:479)rnrnrnroot cause rnrnjava.lang.ClassFormatError: com/neusoft/webbusiness/businessaccept/ui/CancelCDMA1XServlet (Illegal constant pool type)rn at java.lang.ClassLoader.defineClass0(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:488)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1643)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:937)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1372)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1254)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:867)rn at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)rn at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)rn at java.lang.Thread.run(Thread.java:479)rnrn
帮忙看一个程序,谢谢
[code=C/C++]rn#include rn#include rnDWORD WINAPI ThreadFunc(LPVOID p);rnint main()rnrn HANDLE hThread;rn DWORD threadId;rn hThread=CreateThread(NULL,0,ThreadFunc,0,0,&threadId);rn //Sleep(2000);rn printf("线程2-1:Thread running\n");rn printf("线程2-2:Thread running\n");rn rn return 0;rnrnDWORD WINAPI ThreadFunc(LPVOID p)rnrn printf("线程1-1:Thread launched!\n");rn printf("线程1-2:Thread launched!\n");rn return 0;rnrn[/code]rn运行结果如下:rn[img=C:\Users\programer\Desktop][/img]rn给我分析一下为什么啊 谢谢大家
帮忙看看是怎么回事
vector num;rnint n;rn rnwhile (cin >> n)rn num.push_back(n);rn rnfor (int i = 0, n = 0; i != num.size(); i++)rn n += num[i];rnrncout << n <
帮忙看看是怎么回事。
我的ADSL Moden 不停的提示下列信息,是什么意思啊?从开机就开始,我的Modem是rnTP Link TD8800;rnrnrnThu Jan 01 09:21:22 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:21:22 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:21:22 1970 : STATUS ALARM : PPPoE Up : Interface - ppp-0 rnThu Jan 01 09:21:22 1970 : WARNING : PPP Interface Down : Interface - ppp-0 rnThu Jan 01 09:18:57 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:18:57 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:18:56 1970 : STATUS ALARM : PPPoE Up : Interface - ppp-0 rnThu Jan 01 09:18:56 1970 : WARNING : PPP Interface Down : Interface - ppp-0 rnThu Jan 01 09:16:11 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:16:11 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:16:11 1970 : STATUS ALARM : PPPoE Up : Interface - ppp-0 rnThu Jan 01 09:16:11 1970 : WARNING : PPP Interface Down : Interface - ppp-0 rnThu Jan 01 09:12:21 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:12:21 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:12:21 1970 : STATUS ALARM : PPPoE Up : Interface - ppp-0 rnThu Jan 01 09:12:21 1970 : WARNING : PPP Interface Down : Interface - ppp-0 rnThu Jan 01 09:11:51 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:11:51 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:11:41 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:11:41 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:11:41 1970 : STATUS ALARM : PPPoE Up : Interface - ppp-0 rnThu Jan 01 09:11:41 1970 : WARNING : PPP Interface Down : Interface - ppp-0 rnThu Jan 01 09:09:21 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:09:21 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:09:08 1970 : STATUS ALARM : PPP Interface Up : Interface - ppp-0 rnThu Jan 01 09:09:08 1970 : STATUS ALARM: PPP Authorization Successful : Interface - ppp-0 rnThu Jan 01 09:09:08 1970 : STATUS ALARM : PPPoE Up : Interface - ppp-0 rnThu Jan 01 09:09:08 1970 : WARNING : PPP Interface Down : Interface - ppp-0 rn
帮忙看看是哪里写错了
刚学java没多久,好多东西不会,下面这段程序用了hibernate,但运行出错,各位帮忙查一查啊rn[code=Java]package stuServices;rnrnimport javax.persistence.Entity;rnimport javax.persistence.Id;rnrnrn@Entityrnpublic class Student rn rn private int id;rn private String name;rn private String sex;rn rn @Idrn public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rn public String getSex() rn return sex;rn rn public void setSex(String sex) rn this.sex = sex;rn rnrn[/code]rn这一段是文档里直接复制下来的rn[code=Java]package stuServices;rnrnimport org.hibernate.SessionFactory;rnimport org.hibernate.cfg.AnnotationConfiguration;rnrnrnpublic class HibernateUtil rn private static final SessionFactory sessionFactory = buildSessionFactory();rnrn private static SessionFactory buildSessionFactory() rn try rn // Create the SessionFactory from hibernate.cfg.xmlrn return new AnnotationConfiguration().configure().buildSessionFactory();rn rn catch (Throwable ex) rn // Make sure you log the exception, as it might be swallowedrn System.err.println("Initial SessionFactory creation failed." + ex);rn throw new ExceptionInInitializerError(ex);rn rn rnrn public static SessionFactory getSessionFactory() rn return sessionFactory;rn rnrn[/code]rn[code=Java]package test.stuServices;rnrnimport java.util.List;rnrnimport org.hibernate.Query;rnimport org.hibernate.classic.Session;rnrnimport stuServices.HibernateUtil;rnimport stuServices.Student;rnrnrnpublic class TestStu rnrn public static void main(String args[])rn Session session = HibernateUtil.getSessionFactory().openSession();rn session.beginTransaction();rn Query q = session.createSQLQuery("select * from student");rn List students = (List)q.list();rn rn for (Student stu : students) rn System.out.println(stu.getName());rn rn session.getTransaction().commit();rn session.close();rn rnrn[/code]rn运行显示的错误是:rn13:52:24,344 INFO SchemaUpdate:217 - schema update completernHibernate: rn selectrn * rn fromrn studentrn[color=#FF0000]Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to stuServices.Studentrn at test.stuServices.TestStu.main(TestStu.java:20)[/color]
大家帮看看是哪的问题!~
<%rn name = Request("name") rn email= Request("email")rn age = Request("age")rn sex = Request("sex")rn text= Request("text")rnrnset conn=server.createobject("adodb.connection")rnconn.open "driver=microsoft access driver (*.mdb);dbq="&server.mappath("user.mdb")rnrnexec="insert into user(name,email,age,sex,text)values('"+name+"','"+email+"','"+age+"','"+sex+"','"+text+"')"rnconn.execute execrnconn.closernset conn=nothingrnresponse.write "记录添加成功!"rn%>rnrnrnrn总出现:rnMicrosoft VBScript 编译器错误 错误 '800a03f6' rnrn缺少 'End' rnrn/iisHelp/common/500-100.asp,行242 rnrnMicrosoft OLE DB Provider for ODBC Drivers 错误 '80040e14' rnrn[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。 rnrn/user/post.asp,行18 rn
菜鸟求教,看看是哪的问题
我添加信息,保存后刷新gridview的数据,代码是这样写的rnrn保存button()rnrn 保存代码;rn 重新查询数据库;rn 绑定gridview;rnrn rn这样做没有达到需求,设断点,看了数据库已经保存,可是执行到重新查询数据库时却没有更新,难道要大括号执行完重新查询才能更新么,那我怎么写保存完刷新的代码呢
C程序 段错误的问题
[code=C/C++]rn#include rnrnstatic char array[128];rnrnvoid fun(char *);rnrnint main(void)rnrn printf("please enter a string:\n");rn gets(array);rnrn fun(array);rn return 0;rnrnrnvoid fun(char *p)rnrn int count = 0;rn int length;rn char *p2 = p;rn rn for (; *p != '\0';)rn rn for (; p == p2; )rn rn if ((*p >=65 && *p <= 90) || (*p >= 97 && *p <= 122))rn rn p++;rn rn elsern rn p++;rn p2++;rn rn rnrn for (; p != p2; )rn rn if ((*p >=65 && *p <= 90) || (*p >= 97 && *p <= 122))rn rn p++;rn rn elsern rn for (; p2 < p; p2++)rn rn putchar(*p2);rn rn putchar('\n');rn rn rn rn rnrnrn[/code]rnrn上面这个C程序的功能是,输入一个字符串(包括字母数字空格..),然后分别输出其中的每个单词。rn但是如果输入的字符串以空格结尾,输出的时候会报段错误。rnrn例如:输入:[color=#FF0000]abc空格[/color] 然后回车rn 输出:[color=#FF0000]abcrn 段错误[/color]rnrn哪位好心人帮我看看错在哪里
帮忙看看是哪的问题.弄好久了,郁闷.
我的留言本是从表单用post方式提交留言数据的,想获取相应留言内容的id以便来删除它,我数据库里id这个字段用的是int,可以吗?不知我说的是不是清楚,可以到这里看看,解决即高分结帖.谢谢了.http://community.csdn.net/Expert/topic/5354/5354255.xml?temp=.3774378
请高手帮忙看看是哪的问题(eclipse+hibernate)
我用eclipse作了一个程序,结果服务都能正常启动,而jsp页面却无法显示,报以下错误:rnrnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: Unable to compile class for JSPrnrnAn error occurred at line: 13 in the jsp file: /course.jsprnGenerated servlet error:rnThe type net.sf.hibernate.HibernateException cannot be resolved. It is indirectly referenced from required .class filesrnrnrn org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)rn org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)rn org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:386)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:280)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:259)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)rn org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/5.5.3 logs.rnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/5.5.3
大家帮忙看看是哪的问题,我实在没办法了,帮帮忙!!!
我的JSP页面出错如下:rn org.apache.jasper.JasperException: Unable to compile class for JSPrnrnAn error occurred at line: 21 in the jsp file: /try.jsprnrnGenerated servlet error:rn [javac] Compiling 1 source filernrnF:\tomcat\jakarta\work\Catalina\localhost\mywork\org\apache\jsp\try_jsp.java:72: cannot access tree.GuardForceBeanrnrnrnrnAn error occurred at line: 21 in the jsp file: /try.jsprnrnGenerated servlet error:rnbad class file: F:\tomcat\jakarta\webapps\mywork\WEB-INF\classes\tree\GuardForceBean.classrnclass file contains wrong class: GuardForceBeanrnPlease remove or make sure it appears in the correct subdirectory of the classpath.rn GuardForceBean read = (GuardForceBean)unmarshaller.unmarshal(reader);rn ^rn1 errorrnrnrn我的BEAN 都放在F:\tomcat\jakarta\webapps\mywork\WEB-INF\classes\tree下,有GuardForceBean.class,JSP代码中也包括<%@ page import="tree.*" %>,我不知道是哪出了错,是设置问题还是代码问题呢?这个问题搞了好久都没搞出来,我又很菜,大家帮帮忙啊!!!!谢谢了
整体调用的问题,请帮忙看看是哪出错了。
我做的一个新间系统,上面是头,下面是左右结构的。左边是检索,右边是新闻列表。头是一个页面,检索我单独做了一个页面,新闻列表也间独做了一个页面,在主页面调用以上三个页面,调用头和检索页面一切正常,但在调用新闻列表时出现HTTP 500内部错误。开始以为新闻列表数据有误,调试正常。但在主页面调用时就出现错误提示,去掉新闻列表的调用,页面正常。请各位高手指教。
大家帮忙看看是哪的问题xmlspy里报错!!!
rnrn rn rn rn rn rn rn rn rn rn rn rn
C语言高手看看是怎么回事
定义了一个char *类的数据,应该怎么给它初始化以及赋值?rn为什么我初始化以及赋值以后总是打印出来乱码呢?
一个用c语言写的小程序
实现了播放器的基本功能 不足的是定位功能没有实现
用C语言写的一个图形界面程序
作者无聊时用Dev-C++编写的一个图形界面小程序,图形显示精准的打开文件时间和上个月、这个月、下个月的日历。
用C语言写一个扫雷程序
运行环境:win10   vs2013         本程序所有设计思路均已注释行为标记在程序中,为了方便起见,将不在博客中进行书写,想要学的朋友复制下面的源码可进行学习,也可将程序进行修改获取不同的游戏体验 程序原始截图   运行结果: 附上源码   #include&amp;lt;stdint.h&amp;gt; #include&amp;lt;stdlib.h&amp;gt;...
用C语言写一个程序
先把文件打开,然后设计几个选项,1.读出文件内容 2.统计字数 3.添加内容。这个程序这么写呀,高手帮一忙!!!谢谢!
帮忙看看是怎么回事(小程序)??
猴子吃桃问题rn#include rn#include rnint sum(int n)rnrn int sum1;//定义最后一天剩下了1个桃子rn if(n==1)rn sum1=1;rn if(n>1)rn rn return 2*(sum(n-1)+1);//递归调用,实际上就是sum(n)=2*(sum(n-1)+1)rn rn return true;rnrnvoid main()rnrn int m=0;rn cout<<"请输入猴子吃桃的天数:";rn cin>>m;rn if(m==0)rn cout<<"您输入的天数不符合规则!!!!!"<=1)rn rn sum(m);rn cout<
帮忙看C程序的问题
#include rn#include rn#include rnrnvoid main()rnrn1。 char *sdp = new char[300] ;rnrn if (sdp ==NULL)rn rn return;rn rn2。 printf("sdp len=%d\n",strlen(sdp));rn rn sprintf(sdp,"%s","peng\r\n");rnrn char *sdp1 =sdp;rn sdp1 +=strlen(sdp);rn sprintf(sdp1,"%s","m=video 0 RTP/AVP 96\r\na=rtpmap:96 MP4V-ES/90000\r\na=fmtp:96 profile-level-id=3;config=00000100000001200086c400670c161048518f\r\na=control:trackID=1\r\n");rnrn printf("sdp len=%d\n",strlen(sdp));rnrn char *sdp2 =sdp;rn sdp2 +=strlen(sdp);rn sprintf(sdp2,"%s","m=audio 0 RTP/AVP 97\r\na=rtpmap:97 AMR/8000\r\na=fmtp:97 octet-align=1\r\na=control:trackID=2\r\n");rn rn printf("sdp len=%d\n",strlen(sdp));rnrn printf("sdp=%s\n",sdp);rnrn delete sdp;rnrn system("pause");rnrn return;rnrnrnrn问题:第1。行为char *sdp = new char[300] ;但是 第2。行打印出的sdp len 竟然是sdp len=304rnrn为什么不是300而是304呢?那么我在后面通过sprintf函数能向sdp中填充的字节数应该是不多于多少呢?rnrn若改为char *sdp = new char[1000] ;第2。行打印出的sdp len 竟然是sdp len=1016rnrn这是怎么回事呢?为什么总比申请的空间要大,但又不是增加固定大小?rnrn
C语言sprintf使用出现段错误
#include #include void Block(int function_no,int instrument_no) { char *function; char *instrument; char *result; sprintf(function,"%d",function_no); sprintf(instrument,"%d",instrument_no);
各位大家,帮忙根据下面的要求写一个程序,用c语言写的,在这先谢谢
(1) 随机产生50个空的满二叉树。树的深度是4,所以叶子节点有8个。rn(2) 在这50个空的二叉树的除叶子外的其他节点的位置,随机产生数字“0,1,2,3”。rn(3) 在这50个空的二叉树的叶子结点的位置,随机产生这些字符“a,b,c,d,e和#”,其中#表示空字符。 rn随机生成后的满二叉树两两不相同。
C语言段错误详解
里面整理了,我收集的c语言段错误分析的文章,和core调试方法
帮忙看看是哪里错了
struct strFileinfornrn char strFilename[30];rn char strTradename[5];rn char strChinesename[50];rnrn int inti;rnrn struct strFileinfo *next;rnrn;rnrnselectdb(void)rnrn char *ch;rn struct strFileinfo *p;rn printf("请选择要打印的文件");rn gets(ch);rn p=head;rn printf("%s",ch);rn for(p=head;p->next!=NULL;p=p->next)rn rn if(strcmp(ch,p->inti)==0) break;rnrn rn printf("%s",p->strFilename);rnrnrnrn不知道为什么到if(strcmp(ch,p->inti)==0) break; 这里出错 请问是什么原因,是不是strcmp用错了rnrnrn
请帮忙看看是怎么回事
create table teacherrn(教工号 int primary key identity(1,1),rn姓名 varchar(20) null,rn家庭住址 char(30) null,rn电话 int null,rn[color=#FF6600]性别 char(2) default "男" ,[/color]rn课程名 varchar(10) constraint chanamelrncheck(课程名 in ("数学","语文","化学","英语","物理"))rn rn)rn编译报错说,红色字部分错误,说是不能用"男"这个列名,具体不明白是为什么?请帮忙改正
帮忙看看是BUG吗?
前几天无意发现一个问题:rn System.Web.UI.WebControl.RadioButton rb=new System.Web.UI.WebControl.RadioButton();rn System.Web.UI.WebControl.CheckBox bx=new System.Web.UI.WebControl.CheckBox();rn if(rb is bx)//此处的返回值是true,是一个BUG吗?rn rnrn 如果将CheckBox和RadioButton变成WinForm的控件,则返回值为false.rnrn 另:喜欢的朋友加QQ357586710,注明本书名.
请教:c语言段错误
在下在linux下编了一个简单的关于数据结构中"栈"的程序,编译一切正常,但是无法运行,而且提示是段错误,希望各位大侠客不吝赐教.rn以下我将程序的大致思路贴出来,希望大家帮帮我分析一下,谢谢了.rnrn#include rn#define MAXNUM 888 rn /*定义栈结构-顺序栈*/ rn typedef structrn rn int stack[MAXNUM];/*循序栈*/ rn int top;/*栈指针*/ rn STACK,*PSTACK;rn /*栈的初始化*/ rn void init_stack(PSTACK head)rn rn head->top=-1;rn// return 0;rn rn /*入栈*/ rn void push_stack(PSTACK head,int x)rn rn// if(head->top>=MAXNUM-1)/*栈满,无法入栈*/rn// return 0;rn head->stack[++head->top]=x;rn// return 1; rn rn /*出栈*/ rn void pop_stack(PSTACK head) rn rn// if(head->top<0)/*空栈/rn// return 0;rn return head->stack[head->top--];rn rnrnvoid main(void)rnrnPSTACK pp;rninit_stack(pp);rnpush_stack(pp,1);rnpush_stack(pp,2);rnpush_stack(pp,3);rnpop_stack(pp)rnpop_stack(pp)rnpop_stack(pp)rn
c语言 段错误 linux
当写c语言时,经常遇到段错误,很多人都是用printf,但是当程序比较大时,就比较难找了,或者当程序运行时并不会立即出现段错误,而是经过很长一段时间才会出现那么用printf显然不行。这时就可以使用gdb来调试了 首先查看区块数(内核数据转存core文件的上限,单位为区块)详细查看ulimit使用(控制系统资源) ulimit -c unlimited 设置为无限 ulimit -c  查
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview