Java小白,不知道程序怎么改,运行时报错是数组越界

想要这个程序运行出来要怎么改呢

public class point {
    private int x,y;
    public void setpoint(int a,int b){
        x=a;
        y=b;
    }
    public int getx(){
        return x;
    }
    public int gety(){
        return y;
    }
    public String toString(){
        return "["+this.getx()+","+this.gety()+"]";
    }

    public static void main(String[] args) {
        args[0]="2";
        args[1]="3";
        int i,j;        
        i=Integer.parseInt(args[0]);
        j=Integer.parseInt(args[1]);
        point dot=new point();
        dot.setpoint(i, j);
        System.out.printl

5个回答

数组越界的原因是你没有对args进行初始化长度,导致你在为args赋值时出现错误
args =new String[3];
args[0]="2";
args[1]="3";
这样就可以了

你没有给数组 args 设置一个长度,他会默认长度为0,那你给 args 赋值时就会报数组下标越界

args的长度没有定义,出现错误

args是命令行参数,你运行时带上两个或两个以上的参数就好了。
比如:
java point.class arg1 arg2

args是运行时传给程序参数用的,如果用eclipse开发环境的话,在Program arguments把参数传进去。 默认没有参数的话,长度为0,所以发生越界。
一般来说,这个参数只能用于读取,不应该在代码里给它赋值。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Java小白,不知道这个程序怎么改,运行时提示的错误是数组越界,但这个string args【】不知道怎么定义长度
这个程序要怎么改,运行时提示的错误是数组越界,但这个string args【】不知道怎么定义长度rn[code=java]rnpublic class point rn private int x,y;rn public void setpoint(int a,int b)rn x=a;rn y=b;rn rn public int getx()rn return x;rn rn public int gety()rn return y;rn rn public String toString()rn return "["+this.getx()+","+this.gety()+"]";rn rnrn public static void main(String[] args) rn args[0]="2";rn args[1]="3";rn int i,j; rn i=Integer.parseInt(args[0]);rn j=Integer.parseInt(args[1]);rn point dot=new point();rn dot.setpoint(i, j);rn System.out.println(dot.toString());rnrn rnrnrnrn[/code]
GUI程序运行时老是报错,不知道怎么搞?
错误信息如下:rnGtk-WARNING **: Failed to load module "libcanberra-gtk-module.so": libcanberra-gtk-module.so: cannot open shared object file: 没有该文件或目录rnrn折磨了我一个星期了。我用的是GNOME库。
程序运行时报错
rn************** 异常文本 **************rnSystem.NullReferenceException: 未将对象引用设置到对象的实例。rn 在 CSL.TrustedServer.Stop() 位置 C:\Users\ClarIDy\Desktop\CS461 Access Control 2.0.0.5\CS461_HL_API.cs:行号 3789rn 在 CS461_Access_Control.frmMain.stopReadTags() 位置 C:\Users\ClarIDy\Desktop\CS461 Access Control 2.0.0.5\frmForm1.cs:行号 264rn 在 System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)rn 在 System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)rn 在 System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)rn 在 System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)rn 在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)rn 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)rn 在 System.Windows.Forms.Control.WndProc(Message& m)rn 在 System.Windows.Forms.ToolStrip.WndProc(Message& m)rn 在 System.Windows.Forms.MenuStrip.WndProc(Message& m)rn 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)rn 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)rnrn以上是我运行程序时,点击停止程序时报的错误信息。程式是放在服务器E盘的,可以点击查询功能,并返回数据。该程序是在我笔记本上编写,于其他电脑上运行均无错误,只是放到服务器上运行时就这样了。程式是打包成.exe文件运行的。
WinCE程序运行时报错
程序运行一会儿后报错:rn应用程序 XXX(应用程序名) 执行了一个非法操作,将被关闭。若问题持续出现,请与程序提供供应商联系。rn程序:XXX(应用程序名)rn异常:0X80000002rn地址:018047C0rn请高手解决,谢谢!
新手 提问 程序不知道怎么改
import java.io.*;rnpublic class test2 rnrn public static void main(String[] args) rn float n=0;rn System.out.println("please input a number:");rn n=(float)System.in.read();rn int i;float j;rn i=(int)n;rn j=n-i;rn System.out.println("整数部分="+i+";"+"小数部分等于"+j);rn rnrnrn请高手指点
动态链接错误信息,不知道程序怎么改!!!
一.我定义了个动态链接库dongtai.dll工程,工程里dongtai.cpp定义如下: rnrn #include rn #include rn #pragma hdrstop rn #pragma argsused rnrn int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved) rn rn return 1; rn rn//--------------------------------------------------------------------------- rn int __stdcall test()return 3; rnrn二.project option里Packages标签:去除Builder with runtime packages检查框。Linker标签:去除Use dynamic RTLrnrn 检查框。rnrn二.编译生成dongtai.dll rn rn四.我在Form1上放个Edit1,Button1,在Unit1.cpp头部声明: rn rn //Unit1.cpp rnrn int __stdcall (*test)(void); [color=#FF0000]//程序断点在下一行开始,到最后 [/color] rn rn Button1click事件如下: rnrn void __fastcall TForm1::Button1Click(TObject *Sender) rn rn HINSTANCE hInst; //获得实例句柄 rnrn hInst = LoadLibrary("E:\c++练习\dll练习3\dongtai.dll""); rnrn (FARPROC &)test=GetProcAddress(hInst,"test"); rn rn Edit1-> Text=test(); //我要实现的句子 rnrn FreeLibrary(hInst); //释放dll rn rnrn五.编译错误消息(如附件),请帮忙解决下. rn
不知道怎么改
D:\程序设计>javac JDialogDemo1.javarnJDialogDemo1.java:4: 类 MyDialog 是公共的,应在名为 MyDialog.java 的文件中声明rnpublic class MyDialog extends JDialog implements ActionListenerrn rnrn这是什么意思,哪里出错了,怎么改 ^
不知道怎么改?
有点问题,希望帮我啊 rnpublic class Drn C[] arrays = new C[5];rn D()rn for(int i = 0;i < arrays.length; i++)rn arrays[i] = new C();rn rn rn rn D(String s)rn for(int i = 0;i < arrays.length; i++)rn arrays[i] = new C(s);rn rn rn String[] sa1 = "aa","ss","dd","ff","gg";rn rn public static void main(String[] args)rn D yuan = new D();rn for (int i = 0 ;i < sa1.length;i ++)rn D qian = new D(sa1[i]);rn rn rnrnrnclass Crn C()rn System.out.println("Hello World!!");rn rn C(String s)rn System.out.println("Hello"+s);rn rn
android编译时报错 不知道怎么改 求教
[img=https://img-bbs.csdn.net/upload/201708/05/1501922401_385920.jpg][/img]rn[img=https://img-bbs.csdn.net/upload/201708/05/1501922786_28988.jpg][/img]rn这样 我真的不知道从哪里改起啊。。。代码也没报错啊。。。求大神指教,跪谢
求助,报错程序怎么改啊
[code=C/C++][/code]rnrn/*-----------------------------------------rn STOKFONT.C -- Stock Font Objectsrn (c) Charles Petzold, 1998rn -----------------------------------------*/rnrn#include rnrnLRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;rnrnint WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,rn PSTR szCmdLine, int iCmdShow)rnrn static TCHAR szAppName[] = TEXT ("StokFont") ;rn HWND hwnd ;rn MSG msg ;rn WNDCLASS wndclass ;rn rn wndclass.style = CS_HREDRAW | CS_VREDRAW ;rn wndclass.lpfnWndProc = WndProc ;rn wndclass.cbClsExtra = 0 ;rn wndclass.cbWndExtra = 0 ;rn wndclass.hInstance = hInstance ;rn wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;rn wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;rn wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;rn wndclass.lpszMenuName = NULL ;rn wndclass.lpszClassName = szAppName ;rn rn if (!RegisterClass (&wndclass))rn rn MessageBox (NULL, TEXT ("Program requires Windows NT!"), rn szAppName, MB_ICONERROR) ;rn return 0 ;rn rn rn hwnd = CreateWindow (szAppName, TEXT ("Stock Fonts"),rn WS_OVERLAPPEDWINDOW | WS_VSCROLL,rn CW_USEDEFAULT, CW_USEDEFAULT,rn CW_USEDEFAULT, CW_USEDEFAULT,rn NULL, NULL, hInstance, NULL) ;rn rn ShowWindow (hwnd, iCmdShow) ;rn UpdateWindow (hwnd) ;rnrn while (GetMessage (&msg, NULL, 0, 0))rn rn TranslateMessage (&msg) ;rn DispatchMessage (&msg) ;rn rn return msg.wParam ;rnrnrnLRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)rnrn static structrn rn int idStockFont ;rn TCHAR * szStockFont ;rn rn stockfont [] = OEM_FIXED_FONT, "OEM_FIXED_FONT",rn ANSI_FIXED_FONT, "ANSI_FIXED_FONT", rn ANSI_VAR_FONT, "ANSI_VAR_FONT",rn SYSTEM_FONT, "SYSTEM_FONT",rn DEVICE_DEFAULT_FONT, "DEVICE_DEFAULT_FONT",rn SYSTEM_FIXED_FONT, "SYSTEM_FIXED_FONT",rn DEFAULT_GUI_FONT, "DEFAULT_GUI_FONT" ;rnrn static int iFont, cFonts = sizeof stockfont / sizeof stockfont[0] ;rn HDC hdc ;rn int i, x, y, cxGrid, cyGrid ;rn PAINTSTRUCT ps ;rn TCHAR szFaceName [LF_FACESIZE], szBuffer [LF_FACESIZE + 64] ;rn TEXTMETRIC tm ;rn rn switch (message)rn rn case WM_CREATE:rn SetScrollRange (hwnd, SB_VERT, 0, cFonts - 1, TRUE) ;rn return 0 ;rnrn case WM_DISPLAYCHANGE:rn InvalidateRect (hwnd, NULL, TRUE) ;rn return 0 ;rnrn case WM_VSCROLL:rn switch (LOWORD (wParam))rn rn case SB_TOP: iFont = 0 ; break ;rn case SB_BOTTOM: iFont = cFonts - 1 ; break ;rn case SB_LINEUP:rn case SB_PAGEUP: iFont -= 1 ; break ;rn case SB_LINEDOWN:rn case SB_PAGEDOWN: iFont += 1 ; break ;rn case SB_THUMBPOSITION: iFont = HIWORD (wParam) ; break ;rn rn iFont = max (0, min (cFonts - 1, iFont)) ;rn SetScrollPos (hwnd, SB_VERT, iFont, TRUE) ;rn InvalidateRect (hwnd, NULL, TRUE) ;rn return 0 ;rn case WM_KEYDOWN:rn switch (wParam)rn rn case VK_HOME: SendMessage (hwnd, WM_VSCROLL, SB_TOP, 0) ; break ;rn case VK_END: SendMessage (hwnd, WM_VSCROLL, SB_BOTTOM, 0) ; break ;rn case VK_PRIOR:rn case VK_LEFT:rn case VK_UP: SendMessage (hwnd, WM_VSCROLL, SB_LINEUP, 0) ; break ;rn case VK_NEXT: rn case VK_RIGHT:rn case VK_DOWN: SendMessage (hwnd, WM_VSCROLL, SB_PAGEDOWN, 0) ; break ;rn rn return 0 ;rnrn case WM_PAINT:rn hdc = BeginPaint (hwnd, &ps) ;rnrn SelectObject (hdc, GetStockObject (stockfont[iFont].idStockFont)) ;rn GetTextFace (hdc, LF_FACESIZE, szFaceName) ;rn GetTextMetrics (hdc, &tm) ;rn cxGrid = max (3 * tm.tmAveCharWidth, 2 * tm.tmMaxCharWidth) ;rn cyGrid = tm.tmHeight + 3 ;rnrn TextOut (hdc, 0, 0, szBuffer, rn wsprintf (szBuffer, TEXT (" %s: Face Name = %s, CharSet = %i"),rn stockfont[iFont].szStockFont, rn szFaceName, tm.tmCharSet)) ;rnrn SetTextAlign (hdc, TA_TOP | TA_CENTER) ;rnrn // vertical and horizontal linesrnrn for (i = 0 ; i < 17 ; i++)rn rn MoveToEx (hdc, (i + 2) * cxGrid, 2 * cyGrid, NULL) ;rn LineTo (hdc, (i + 2) * cxGrid, 19 * cyGrid) ;rnrn MoveToEx (hdc, cxGrid, (i + 3) * cyGrid, NULL) ;rn LineTo (hdc, 18 * cxGrid, (i + 3) * cyGrid) ;rn rn // vertical and horizontal headingsrnrn for (i = 0 ; i < 16 ; i++)rn rn TextOut (hdc, (2 * i + 5) * cxGrid / 2, 2 * cyGrid + 2, szBuffer,rn wsprintf (szBuffer, TEXT ("%X-"), i)) ;rnrn TextOut (hdc, 3 * cxGrid / 2, (i + 3) * cyGrid + 2, szBuffer,rn wsprintf (szBuffer, TEXT ("-%X"), i)) ;rn rn // charactersrnrn for (y = 0 ; y < 16 ; y++)rn for (x = 0 ; x < 16 ; x++)rn rn TextOut (hdc, (2 * x + 5) * cxGrid / 2, rn (y + 3) * cyGrid + 2, szBuffer,rn wsprintf (szBuffer, TEXT ("%c"), 16 * x + y)) ;rn rnrn EndPaint (hwnd, &ps) ;rn return 0 ;rn rn case WM_DESTROY:rn PostQuitMessage (0) ;rn return 0 ;rn rn return DefWindowProc (hwnd, message, wParam, lParam) ;rnrnrnrn报错提示:rn1>f:\code\mfc\报错程序集锦\keyborad3\keyborad3\keyborad3.cpp(60): error C2440: “初始化”: 无法从“const char [15]”转换为“TCHAR *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn1>f:\code\mfc\报错程序集锦\keyborad3\keyborad3\keyborad3.cpp(61): error C2440: “初始化”: 无法从“const char [16]”转换为“TCHAR *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn1>f:\code\mfc\报错程序集锦\keyborad3\keyborad3\keyborad3.cpp(62): error C2440: “初始化”: 无法从“const char [14]”转换为“TCHAR *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn1>f:\code\mfc\报错程序集锦\keyborad3\keyborad3\keyborad3.cpp(63): error C2440: “初始化”: 无法从“const char [12]”转换为“TCHAR *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn1>f:\code\mfc\报错程序集锦\keyborad3\keyborad3\keyborad3.cpp(64): error C2440: “初始化”: 无法从“const char [20]”转换为“TCHAR *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn1>f:\code\mfc\报错程序集锦\keyborad3\keyborad3\keyborad3.cpp(65): error C2440: “初始化”: 无法从“const char [18]”转换为“TCHAR *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn1>f:\code\mfc\报错程序集锦\keyborad3\keyborad3\keyborad3.cpp(66): error C2440: “初始化”: 无法从“const char [17]”转换为“TCHAR *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn1>rn1>生成失败。
求助,我的vc+mapx程序运行时报错:0xc0000005 Access violation!不知道怎么改,卡了我好久
我对程序进行了跟踪,发现这个内存错误是在程序运行完退出时出现的,我用vc的call stack查看到是在执行MSVCRT! 77bfb929()时报错的,程序提示下面这行报错:rn77BFB929 mov ecx,dword ptr [edx]rn我对汇编不懂,根本就不知道是什么意思啊,我想请问各位大虾,这个错误改怎么改啊rnrn
求大佬指点一下,程序报错不知道怎么改
求大佬指点一下,程序报错不知道怎么改 Error:Execution failed for task ‘:app:preDebugAndroidTestBuild’. Conflict with dependency ‘com.android.support:support-annotations’ in project ‘:app’. Resolved versions for app (26...
第一个程序程序就错了,不知道怎么改
这两天来这里发现一个好地方,于是决定开始学汇编语言)周日买了本电子工业出版社出版的高等专科教材《80486(80X86)汇编语言程序设计》按这里大家的推荐下载了masm8,可是按书上第一个程序输进去运行就出错了,程序是求两数和:rndat segment 'data'rnx db 10hrny db 20hrndat endsrnsta segment stack 'stack'rndb 100 dup(?)rnsta endsrncod segment 'code'rnassume cs:cod,ds:dat,ss:starnstart:mov ax,datrnmov ds,axrnmov al,xrnadd al,yrnmov dl,alrnor dl,30hrnmov ah,2rnint 21hrnmov ah,4chrnint 21hrncod endsrnend startrnrn错误信息:rn Assembling: C:\masm32\source\a.asmrnC:\masm32\source\a.asm(10) : error A2004: symbol type conflictrnC:\masm32\source\a.asm(21) : warning A4023: with /coff switch, leading underscore required for start address : startrnrn是不是说start有问题??)我英语不好(可是start有什么问题呢??rn
数据库升级到10g后,程序报错,数组越界
如图,升级后,以往正常的程序,报错如下:rnjava.lang.ArrayIndexOutOfBoundsException: -32233rn at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2672)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10688)rn at weblogic.jdbc.wrapper.PreparedStatement.executeBatch(PreparedStatement.java:186)rn at com.sinosoft.lis.vdb.LIAboriginalDataDBSet.insert(LIAboriginalDataDBSet.java:1009)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at com.sinosoft.lis.pubfun.PubSubmit.saveData(PubSubmit.java:338)rn at com.sinosoft.lis.pubfun.PubSubmit.submitData(PubSubmit.java:53)rn at com.sinosoft.lis.taskservice.XQInterFaceService.RunInterfaceService(XQInterFaceService.java:126)rn at com.sinosoft.lis.taskservice.XQInterFaceService.run(XQInterFaceService.java:44)rn at java.lang.Thread.run(Thread.java:534)rnrn在(PubSubmit)中抛出如下错误:执行插入语句失败rnrn求高手指点。谢谢。
运行时报错,可是不知道问题出在哪儿……
[code=c]BYTE * DibLoadImage(HINSTANCE hInstance,HWND hwnd,UINT nID)rnrn BYTE * pbmfh;rn BITMAPINFO bmi = 0;rn BITMAPINFO * pbmi = &bmi;rn bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);rn HANDLE hHandle;rn HDC hdc = GetDC(hwnd);rn hHandle = LoadImage(hInstance,MAKEINTRESOURCE(nID),rn IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR);rn if (hHandle == INVALID_HANDLE_VALUE)rn rn return NULL;rn rn if (0 == GetDIBits(hdc,(HBITMAP)hHandle,0,0,NULL,&bmi,DIB_RGB_COLORS))rn rn return NULL;rn rn BYTE * pBits = new BYTE[bmi.bmiHeader.biSizeImage];rn BYTE * pBitsOp = pBits;rn if (!pBits)rn rn return NULL;rn rn if (0 == GetDIBits(hdc,(HBITMAP)hHandle,0,bmi.bmiHeader.biHeight,pBitsOp,&bmi,DIB_RGB_COLORS))rn rn delete [] pBits;rn pBitsOp = NULL;rn pBits = NULL;rn return NULL;rn rn pbmfh = new BYTE[sizeof(BITMAPINFO)+bmi.bmiHeader.biSizeImage];rn if (!pbmfh)rn rn delete [] pBits;rn pBitsOp = NULL;rn pBits = NULL;rn return NULL;rn rn BYTE * Bitinfo = pbmfh;rn for (int i=0;i
java数组越界!
在tomcat项目里我的login.jsp编译没有发现问题!但是当我在浏览器请求页面的时候出现:java.lang.ArrayIndexOutOfBoundsException: 1rn 代码是这样的rn<%@ page contentType="text/html;charset=gb2312" %>rn<%rnString UserName= "",UserEMail="",LoginDate="";rnCookie temp = null;rnCookie[] cookies = request.getCookies();rnint cookielen = cookies.length;rnfor (int i=0; i<=cookielen;i++)rnrn temp = cookies[i];rn if(temp.getName().equals("Name"))rn rn UserName = temp.getValue();rn rn else if (temp.getName().equals("E_Mail"))rn rn UserEMail = temp.getValue();rn rn else if (temp.getName().equals("LoginDate"))rn rn LoginDate = temp.getValue();rn rnrnint tmplen = LoginDate.length();rnboolean FirstLogin ;rnif (tmplen != 0)rnrn FirstLogin = false;rnrnelse FirstLogin = true;rn%>rnrn cookie 有效时间设置rnrnrn Cookie 有效时间设置rnrn rn rn<%rnif( FirstLogin ==true)rnrn%> 欢迎光临!rn<%rnrnelsernrn%>rn 欢迎再度光临rn<%rnrn%>rn<--下面的表单用post方法将资料传给settime.jsp-->rn rn 姓名:rn E_mail:rnrnrnrn
java数组越界?
[img=G:\qq][/img]rnpublic class kkrn public static void main(String args[])rn double a,fee;rn System.out.println("本月用电的度数是: "+args[0]+"du");rn a=Double.parseDouble(args[0]);rn if(a>0)rn if(a<240)rn fee=a*0.15;rn output(fee);rn rn if(a>240&&a<=540)rn fee=(a-240)*0.25+240*0.15;rn output(fee);rn rn rn rn if(a>540)rn fee=((a-540)*0.45+300*0.25+240*0.15);rn output(fee);rn rn rn rn else if(a<0)rn System.out.println("请输入正确的度数!");rn rn rn rn static void output(double result)rn System.out.println("您需要交纳的电费是: "+result+"yuan");rn rnrnrnrnrn这是源代码。输出地结果会是如图所示。那里错误?怎么改正?求教rn
怎么改这个,小白请教
[img=http://img.my.csdn.net/uploads/201212/24/1356319575_3850.png][/img]rnpackage news;rnimport java.io.*;rnimport java.io.IOException;rnimport javax.servlet.http.HttpSession;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnpublic class AdminAction extends HttpServletrn PrintWriter out;rnpublic void doPost(HttpServletRequest request,rn HttpServletResponse response)rn throws IOExceptionrnrn response.setContentType("text/html;charset=gb2312");rn out=response.getWriter();rn HttpSession session=request.getSession(false);rn int adminid=(Integer)session.getAttribute("adminid");rn int power=(Integer)session.getAttribute("power");rn StrEncode SE=new StrEncode();rn String nid=request.getParameter("nid");rn int nnid = Integer.parseInt(nid);rn String cid=request.getParameter("cid");rn String action=request.getParameter("action");rn DBConn conn=new DBConn();rn tryrn NewsAdmin NA=new NewsAdmin();rn if(action.equals("1"))rn if (NA.canAdmin(adminid, nnid) || power > 10) rn NA.DeleNews(nnid);rn response.sendRedirect("index.jsp");rn rn elsern out.print("你无权操作!");rn rn rn if(action.equals("2"))rn int ccid=Integer.parseInt(cid);rn if (power > 10) rn NA.DeleComm(ccid);rn response.sendRedirect("shownews.jsp?nid="+nid);rn rn elsern out.print("你无权操作!");rn rn rnrn rn catch(Exception e)rn out.print("发表评论写入数据库失败!"+e.toString());rn rnrn public void doGet(HttpServletRequest request,rn HttpServletResponse response)rn throws IOExceptionrn rn doPost(request, response);rn rnrnrn
程序运行时报错,请帮忙!
Access violation at address 77C14977 in module 'MSVCRT.DLL'.Read of address 00000010.
我是java小白
1.java 中interger.parseInt  的作用是把string 类型的字符串转化为Int型、 2.agrs:首先,和其他的java程序一样,在命令提示符那个框框里输入 javac ArratTest1 .java 再输入 java ArratTest1 straul good 后面两个字符串随便写什么,它们作为实参传入main函数,straul传入args[0],good传
成员变量的问题(下面程序的错误不知道怎么改)
//成员变量的问题rn#include rnrnusing namespace std;rnrnclass Yearrnprivate:rn int y;rn static const int InitY = 1970;rn//pure specifier can only be specified for functionsrnrnpublic:rn Year()rn rn y = InitY;rn rn int year() constrn rn return y;rn rn void addYear(int i)rn rn y = year() + i;rn rn;rnrnrnint main( )rnrn Year y1;rn Year* const py1 = new Year();rnrn y1.addYear(1);rn py1->addYear(2);rnrn cout << y1.year() << "," << py1->year() << endl;rnrn return 0;rn
程序报链接错,不知道怎么改
Linking...rnNewSocket.obj : error LNK2001: unresolved external symbol "public: void __thiscall CTestDlg::OnAccept(void)" (?OnAccept@CTestDlg@@QAEXXZ)rnDebug/Test.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnTest.exe - 2 error(s), 0 warning(s)
关于C++编写的队列程序,不知道怎么改?
最近我看C++编程时,就最近动手想编个队列程序 其代码如下:rn#include rnusing namespace std;rn#define DEFAULT -1rnclass qtype rn friend class Cqueue;rnpublic:rn qtype(int elem);rn qtype ( );rnprivate:rn int data;rn qtype * next;rn;rninline qtype::qtype( int elem):data(elem),next(0) rninline qtype::qtype( ):data(DEFAULT),next(0) rnrnclass Cqueue rnpublic:rn Cqueue ();rn int queuelen ( ) const ;rn void insert ( int elem,qtype *p= 0) ;rn rn void display ( ) ;rn void insert_front ( int elem);rn qtype *head, *tail;rnprivate:rn int qlen_;rn// qtype *head, *tail;rn Cqueue ( qtype * q) ;rn Cqueue& operator= (const Cqueue&);rnrnrn;rninline Cqueue::Cqueue():qlen_(0),head(0),tail(0) rnrnint Cqueue::queuelen() const rn return qlen_;rnrnvoid Cqueue::insert(int elem,qtype* p ) rn qtype *temp = new qtype (elem);rn if( p != 0)rn temp->next =p->next ;rn p->next = temp;rn qlen_ ++;rnrn else rn atfront( elem);rn rnrnrnrnvoid Cqueue::atfront ( int elem) rn qtype * qtemp = new qtype (elem);rnrn if (!head) rn head = tail = qtemp;rn rn else rn qtemp->next = head;rn head = qtemp;rn rn qlen_++;rnrnvoid Cqueue::display( ) rn //qtype *que = new qtype();rn qtype *que = head;rn cout << "the elem of the queue is:\n" << endl;rn while ( !que) rn cout << que->data << " " <next ;rn rnrnrnvoid main () rn Cqueue myque;rn for (int i = 0; i< 10; i++) rn myque.insert ( i ,myque.head);rn //为了测试列表头的元素/是否在变rn cout << "the value of head is: \n" << myque.head->data << endl; rn rn rn myque.display ();rnrnrn我往列表中插入10个元素,按照我的程序,应该是每次在队列头插入新的表项,但是在测试时输出的元素总是“0”,我检查了自己的程序实在是找不来。rn还有这个的 dispaly()根本没执行借结束了。我也没想明白!rn我是不是在指针分配的时候出什么问题了!rn希望高手们能帮我指出来,rn万分感谢!rn这几天一直很郁闷。简单程序都没法实现。真不知道怎么学编程。rn
求教: 初学者,按教程写的代码运行时出错,不知道怎么改?
教程上的代码rn===================rnimport java.util.*;rnimport java.awt.*;rnpublic class MyThread6_1_2 extends java.applet.Applet implements Runnablern Thread clockThread;rn public void start()rn System.out.println("start! ");rn if(clockThread == null)rn clockThread = new Thread( this, "Clock");rn clockThread.start();rn rn rn public void run()rn System.out.println("start! ");rn while(clockThread != null)rn repaint();rn tryrn clockThread.sleep(1000);rn catch(InterruptedException e)rn rn rn public void paint(Graphics g)rn System.out.println("start! ");rn Date now = new Date();rn //g.drawString( now.getHours() + ":" now.getMinutes() + ":" + now.getSeconds(),5,10);rn g.drawString("now.getSeconds()",5,10);rn rn rn public void stop()rn System.out.println("start! ");rn clockThread.stop();rn clockThread = null;rn rnrn===================rnrn用 java MyThread6_1_2 运行时的Error 提示rnrn=====================rnC:\javaTest>java Mythread6_1_2rnException in thread "main" java.lang.NoClassDefFoundError: Mythread6_1_2 (wrongrnname: MyThread6_1_2)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.access$100(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)rn=====================
运行时报错
[img=https://img-bbs.csdn.net/upload/201904/07/1554607425_695539.png][/img]
出error 不知道怎么改。。。。
#includernrnvoid mySwap(int x, int y)rnrn int temp = 0;rnrn temp = x; [color=#008000] ///// 这地方似乎要加buffer ;求怎么整[/color]rn y = y;rn y = temp;rnrnrnint main(void)rnrn int ival1 = 3;rn int ival2 = 7;rn printf("ival1 = %d, ival2 = %d\n", ival1, ival2);rn mySwap(ival1, ival2);rn printf("ival1 = %d, ival2 = %d\n", ival1, ival2);rnrn return 0;rn
下拉筐不知道怎么改????
rn 用户名:rn rn rn rnrnrn 密码:rn rn rn rnrnrn 部门:rn rn rn 空运出口rn 空运进口rn 海运出口rn 海运进口rn rn rnrnrnrn我把两个文本筐都做了修改(style="BORDER-BOTTOM: #889FC9 1px solid; BORDER-LEFT: #889FC9 1px solid; BORDER-RIGHT: #889FC9 1px solid; BORDER-TOP: #889FC9 1px solid; FONT-SIZE: 9pt"),但下拉筐不知道怎么改。
停车场管理系统,不知道怎么改...
设停车场是一个可停放n辆汽车的狭长通道,且只有一个大门可供汽车进出。汽车在停车场内按车辆到达时间的先后顺序,依次由北向南排列(大门在最南端,最先到达的一辆车停放在车场的最北端),若车场内已停满n辆汽车,则后来的汽车只能在门外的便道上等候,一旦有车开走,则排在便道上的第一辆车即可开入;当停车场内某辆车要离开时,在它之后进入的车辆必须先退出车场为它让路,待该辆车开出大门外,其他车辆再按原次序进入车场,每辆停放在车场的车在它离开停车场时必须按它停留的时间长短交纳费用。试为停车场编制按上述要求进行管理的模拟程序。rn[基本要求]rn 以栈模拟停车场,以队列模拟车场外的便道,按照从终端读入的输入数据序列进行模拟管理。每一组输人数据包括三个数据项:汽车“到达”或“离去”信息、汽车牌照号码以及到达或离去的时刻。对每一组输入数据进行操作后的输出信息为:若是车辆到达,则输出汽车在停车场内或便道上的停车位置;若是车辆离去,则输出汽车在停车场内停留的时间和应交纳的费用(在便道上停留的时间不收费)。栈以顺序结构实现,队列以链表结构实现。rnrnrnrnrnrn[u]输入第一个数据后,S.top又等于0了。。。。于是后面再输入数据的时候,车在停车场的位置永远是1[/u][i][/i][b][/b]rnrnrnrnrnrnrn#includern#includernrnrn#define MAX 10 //定义停车场容量rn#define FEE 5 //每小时停车费为5RMBrnrntypedef struct time //定义时间结点rnrn int hour;rn int min;rnTime;rnrntypedef struct Node //定义车辆结点信息rnrn int num;rn Time reach;rn Time leave;rn int position;rnCarNode;rnrntypedef struct ParkingNode //顺序栈表示停车场rnrn CarNode CarPosition[MAX+1];rn int top;rnSqStackCar;rnrntypedef struct QCarNode //模拟便道rnrn CarNode data;rn struct QCarNode *next;rnQCarNode,*QueuePtr;rntypedef structrnrn QueuePtr front;rn QueuePtr rear;rnLinkQueueCar;rnrnvoid InitStack(SqStackCar &S) //初始化停车场rnrn S.top=0;rnrnrnvoid Push(SqStackCar &S,CarNode &R)//将车停入停车场rn rn S.top++;rn R.position=S.top;rn S.CarPosition[S.top].num=R.num;rn S.CarPosition[S.top].reach.hour=R.reach.hour;rn S.CarPosition[S.top].reach.min=R.reach.min;rn rnrnrnint IsEmpty(SqStackCar S)//判断车库是否为空rnrn return (S.top==0?1:0);rnrnrnint IsFull(SqStackCar S)//判断车库是否为满rnrn return (S.top==MAX?1:0);rnrnrnvoid GetTop(SqStackCar &S,CarNode &C)//将车开出停车场rnrn C.num=S.CarPosition[S.top].num;rn C.leave.hour=S.CarPosition[S.top].leave.hour;rn C.leave.min=S.CarPosition[S.top].leave.min;rnrnrnvoid InitQueue(LinkQueueCar &Q) //初始化便道rnrn Q.front=Q.rear=(QueuePtr)malloc(sizeof(QCarNode));rn if(!Q.front) exit(-2);rn Q.front->next=NULL;rnrnvoid EnQueue(LinkQueueCar &Q,CarNode C)//车辆进入队列rnrn QueuePtr p;rn p=(QueuePtr)malloc(sizeof(QCarNode));rn if(!p) exit(-2);rn p->data.num=C.num;rn p->data.reach.hour=C.reach.hour;rn p->data.reach.min=C.reach.min;rn Q.rear->next=p;rn Q.rear=p;rnrnrnint DeQueue(LinkQueueCar &Q,CarNode &x)//车辆出队列rnrn QueuePtr p;rn if(Q.front==Q.rear) exit (-2);rn p=Q.front->next;rn x.num=p->data.num;rn x.leave.hour=p->data.leave.hour;rn x.leave.min=p->data.leave.min;rn Q.front->next=p->next;rn if(Q.rear==p)Q.rear=Q.front;rn free(p);rn return 0;rnrnrnvoid ParkingFee(CarNode C)rnrn int R1,R2,L1,L2;rn R1=C.reach.hour;rn R2=C.reach.min;rn L1=C.leave.hour;rn L2=C.leave.min;rn printf("车费为: %2.1f元",((L1-R1)*60+(L2-R2))*FEE);rnrnrnvoid Arrival(SqStackCar S,LinkQueueCar Q,CarNode R)rn rn rn if(IsFull(S))rn rn printf("车库已满,请等待\n");rn EnQueue(Q,R); rn rn elsern rn Push(S,R);rn printf("车在停车场的位置为:%d\n",R.position);rn rnrnrnrnvoid Leave(SqStackCar S,SqStackCar S1,LinkQueueCar Q,CarNode C)rnrn int tag=S.top;rn CarNode x;rn if(IsEmpty(S))rn printf("停车场为空,没有此车\n");rn elsern rn for(;C.num!=S.CarPosition[tag].num&&tag>0;tag--)rn rn Push(S1,S.CarPosition[tag]);rn S.top--;rn rn if(C.num==S.CarPosition[tag].num)rn rn S.top--;rn for(;S1.top>0;S1.top--)rn Push(S,S1.CarPosition[S1.top]);rn if(S.top0;S1.top--)rn Push(S,S1.CarPosition[S1.top]);rnrn rn rnrnrnvoid print() rn rn printf("\n请选择:\n"); rn printf("1 :到达\n"); rn printf("2 :离开\n"); rn printf("4 :退出\n");rn printf("\n"); rn rnrnrnint main()rn int m,j;rn int i=1;rn int f=0;rn int n;rn CarNode car[10];rn SqStackCar Sstation;rn SqStackCar Stemp;rn LinkQueueCar Wait;rn InitStack(Sstation);rn InitStack(Stemp);rn InitQueue(Wait);rn while(1)rn rn print();rn scanf("%d",&m);rn switch(m)rn rn case 1:rn printf("请输入车牌号:");rn scanf("%d",&car[i].num);rn printf("车辆到达时间:/**:**/ "); rn scanf("%d:%d",&(car[i].reach.hour),&(car[i].reach.min)); rn Arrival(Sstation,Wait,car[i]);rn i++;rn break;rn case 2:rn printf("请输入车牌号::");rn scanf("%d",&n);rn for(j=0;j<10;j++)rn if(n==car[j].num)rn break;rn printf("请输入车辆离开的时间:/**:**/");rn scanf("%d:%d",&(car[j].leave.hour),&(car[j].leave.min));rn Leave(Sstation,Stemp,Wait,car[j]);rn ParkingFee(car[j]);rn break;rn case 3:rn f=1;rn break;rn default:rn printf("输入有错,请输入1、2或3\n");rn if(f)rn break;rnrn rn return 0;rnrnrnrnrnrn
new 数组越界 系统不会报错
/** \brief 测试 数组越界 , 系统是否有报错 * 测试结果: 不报错 * * \param * \param * \return * */ #include &amp;lt;iostream&amp;gt; using std::cout ; int main(){ int * ary = new int [100...
数组越界居然没报错,为什么?
#includern#includernvoid test1()rnrnchar string[10];rnchar* str1 = "0123456789";rnstrcpy( string, str1 );rncout<
数组越界使用,为什么delete[]报错?
[code=C/C++]rn char* src = new char[7];rn src[7] = 'g';rn delete[] src;rn[/code]rnrn数组是越界使用了,但是异常出在delete里。rndelete应该是new多少,他删多少,但是为什么这样会错?rn谁能告诉下delete的处理过程?
不知道错误提示怎么改!!
行 260: SqlDataAdapter da = new SqlDataAdapter(strsql, aconn);rn行 261: DataSet ds = new DataSet();rn[color=#FF0000]行 262: da.Fill(ds);行[/color] 263: aconn.Close();rn行 264: this.GridView1.DataSource = ds.Tables;rn红字体的地方报错..
下拉筐不知道怎么改?????
rn 用户名:rn rn rn rnrnrn 密码:rn rn rn rnrnrn 部门:rn rn rn 空运出口rn 空运进口rn 海运出口rn 海运进口rn rn rnrnrnrn我把两个文本筐都做了修改(style="BORDER-BOTTOM: #889FC9 1px solid; BORDER-LEFT: #889FC9 1px solid; BORDER-RIGHT: #889FC9 1px solid; BORDER-TOP: #889FC9 1px solid; FONT-SIZE: 9pt"),但下拉筐不知道怎么改。
急,不知道怎么改!
using System;rnrninterface ISort1rnrn double[] getnumber();rnrnrninterface ISort2rnrn double[] numSort();rnrnrninterface ISort3rnrn void outplay();rnrnrnclass Sort : ISort1, ISort2, ISort3rnrn private static int num_count = 0;rn double[] numberValue = new double[num_count];rnrn public void setCount(int NumberCount)rn rn num_count = NumberCount;rn rnrn private bool isNumber(string str)rn rn for (int i = 0; i < str.Length; i++)rn rn if (!char.IsNumber(str,i) && str.Substring(i,1) != ".")rn rn return false;rn rn rnrn return true;rn rnrn public double[] getnumber()rn rn string strline;rnrn for(int num = 0;num < num_count;num++)rn rn Console.Write("Enter the Number: ");rn strline = Console.ReadLine();rnrn if (isNumber(strline))rn rn numberValue[num] = double.Parse(strline);rn rn elsern rn Console.WriteLine("error");rn rn rnrn return numberValue;rn rnrn public double[] numSort()rn rn double temp;rn for(int j = 0; j < numberValue.Length; j++)rn for(int k = j+1; k< numberValue.Length; k++)rn if(numberValue[j] < numberValue[k])rn rn temp = numberValue[j];rn numberValue[j] = numberValue[k];rn numberValue[k] = temp;rn rn return numberValue;rn rnrn public void outplay()rn rn foreach(int i in numberValue)rn Console.Write(" " + i + " ");rn rnrn public static void Main()rn rn Sort sort = new Sort();rn sort.setCount(10);rn sort.getnumber();rn sort.numSort();rn sort.outplay();rn rnrnrn在运行的时候输入一个数字说超出数组索引界限。出错的地方是getnumber方法里的numberValue[num] = double.Parse(strline);和最后的sort.getnumber();rn哪位大哥能帮忙解决。rnrn刚学C#,刚编个简单的程序就这样了,头好晕哦,里面还有几个问题还没解决,睡能先帮我这个问题先,非常感谢
程序出错,不知道怎么改?
以下程序不能运行,请高手帮忙修改!rn<% rn Set conn = Server.CreateObject("ADODB.Connection")'创建一个数据库链接对象conn,方便后面调用rn connstr="Provider=SQLNCLI;Server=127.0.0.1;Database=db1;Uid=sa;Pwd=zzz123;" '创建一个数据库的recordset对象,方便以后调用rn conn.Open connstrrn sql="select * from biao1"rn set rs=server.createobject("adodb.recordset")rn rs.open sql,connstr,1,1rn rs.addnewrn rs("contents")=request.Form("text")rn if request.Form("qqh")=1 thenrn rs("secrit")=1rn elsern rs("secrit")=0rn rs.updatern rs.movenextrn set rs=nothingrn%>rn rn rn rn rn rn rn rn rn rn rn
一个不知道怎么改的错误~~
这是最短路径的迪杰斯特拉算法的实现,在*处有个错误,应该怎么改呢?rn[code=C/C++]rn//graph.hrn#includernusing namespace std;rn#define MAX 20rn#define INF 32767rntypedef struct rn int arcs[MAX][MAX]; //邻接矩阵rnMgraph;rnrn//main.cpprn#includern#include "graph.h"rnusing namespace std;rnvoid dijkstra(Mgraph gn,int vtxnum,int v0,int path[],int dist[])rn int i;rn int s[MAX]; //s用以标记那些已经找到最短路径的顶点,数组的初态只包括顶点v0,即s[0]=1rn dist[i] = gn.arcs[0][i]; //数组dist记录源点到其他各顶点当前的最短距离rn //初始化s,dist,pathrn for(int v=0;v>vtxnum;rn gn.arcs[12][12] = 0,15,4,7,INF,INF,INF,INF,INF,INF,INF,INF, -----------------*rn 15,0,7,INF,15,12,INF,INF,INF,INF,INF,INF,rn 4,7,0,INF,16,INF,INF,INF,INF,INF,INF,INF,rn 7,INF,INF,0,8,INF,INF,INF,26,INF,INF,INF,rn INF,15,16,8,0,20,18,INF,30,INF,INF,INF,rn INF,12,INF,INF,20,0,INF,INF,INF,30,INF,INF,INF,rn INF,INF,INF,18,INF,0,3,INF,16,INF,INF,INF,rn INF,INF,INF,INF,INF,INF,3,0,7,INF,INF,INF,rn INF,INF,INF,26,30,INF,INF,7,0,5,15,INF,INF,rn INF,INF,INF,INF,INF,30,19,INF,5,0,INF,20,rn INF,INF,INF,INF,INF,INF,INF,INF,15,INF,0,9,rn INF,INF,INF,INF,INF,INF,INF,INF,INF,20,9,0;rn cout<<"请输入所要求最短路径的顶点:"<<"\n";rn cin>>v0;rn dijkstra(gn,vtxnum,v0,path,dist);rn cout<<"请输入"<>n;rn for(int i=0;i<=n;i++)rn cout<<"从"<"<<"\n";rn rn system("pause");rn return 0;rnrn[/code]rn在*处有个错误 rnIntelliSense: 应输入表达式 d:\visual studio 2010\program\dijkstra\dijkstra\main.cpp dijkstrarn
一个错误不知道怎么改
[code=css]rn#ifndef _DATE_Hrn#define _DATE_Hrn#include rnclass Daternrnpublic:rn enum Monthjan=1,feb,apr,may,jun,jul,aug,sep,oct,nov,dec;rn class Bad_date;rn Date(int dd=0,Month mm=Month(0),int yy=0);rn void Date::string_rep()const;//输出 rn static void set_default(int,Month,int);rn Date& add_year(int n);rn Date& add_month(int n);rn Date& add_day(int n);rn bool leapyear(int y);rnprivate:rn int d,m,y;rn static Date default_date; rn;rn#endifrn//date-func.cpp:rn#include "date.h"rn#include rnDate::Date(int dd=1,Month mm=Month(1);int yy=1970)rnrn int max;rn switch (mm)rn rn case feb:rn max=28+leapyear(yy);rn break;rn case apr:rn case jun:rn case sep:rn case nov:rn max=30;rn break;rn case jan:rn case mar:rn case may:rn case jul:rn case aug:rn case oct:rn case dec:rn max=31;rn default:rn throw Bad_date();rn rn if (dd<1||max0)rn rn int delta_y=n/12;rn int mm=m+n%12;rn if (mm>12)rn rn delta_y++;rn mm-=12;rn rn //处理month(m)没有天数的情况rn y+=delta_y;rn m=Month(mm);rn return *this;rn rn return *this;rnrnDate& Date::add_day(int n)rnrn if (n==0)return *this;rn if (n>0)rn rn std::tm tm;rn tm.tm_sec=0;rn tm.tm_min=0;rn tm.tm_hour=12;rn tm.tm_mday=1+days;rn tm.tm_mon=1;rn tm.tm_year=70;rn std::mktime(&tm);rn d=tm.tm_mday;rn m=tm.tm_mon;rn y=tm.tm_year; rn return *this; rn rn rnstatic void Date::set_default(int,Month,int)rnrn Date::default_date=Date(d,m,y);rnrnbool Date::leapyear(int y)rnrn if (y%4==0&&y%100!=0||y%400==0)rn return true;rn elsern return false;rnrnvoid Date::string_rep()constrnrn std::cout<rn#include "date.h"rnusing namespace std;rnrnint main()rnrn Date ddate(1,Date::Month(1),1970);rn cout<<"starting:\n";rn cout<<"a.加天数 b.加月数\n";rn cout<<"c.加年数 d.退出\n";rn char s;rn int ld,lm,ly;rn while (cin>>s)rn rn switch (s)rn rn case 'a':rn cout<<"输入要加的天数:"; rn cin>>ld;rn ddate.add_day(ld);rn ddate.string_rep();rn break;rn case 'b': rn cout<<"输入要加的月数:"; rn cin>>lm;rn ddate.add_month(lm);rn ddate.string_rep();rn break;rn case 'c':rn cout<<"要输入的年数:";rn cin>>ly;rn ddate.add_year(ly);rn ddate.string_rep();rn break;rn case 'd':rn cout<<"bye"; rn exit(0);rn default:rn break;rn rn rn system("pause");rn return 0;rnrn[/code]rn要实现的功能是从 1月1日1970年,加天、月、年后的日期,函数报错 rnCircular date_func <- date_func.o dependency dropped. rn怎么改也改不过来了,新手求帮助
帮忙看下 不知道怎么改
#includernint f1(int **a, int m,int n)rnrn int c,i,j;rn for(i=0;i
程序报错,不知道如何解决
我刚开始学vc,遇到了个问题rnnafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadexrnnafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadexrnDebug/test.exe : fatal error LNK1120: 2 unresolved externalsrnError executing link.exe.rnrntest.exe - 3 error(s), 0 warning(s)rnrn不知道如何解决,连接时出现了什么错误啊
程序报错,不知道是什么原因?
在执行登录的时候tomcat报错:rn不知道是什么原因rn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | dnsguardrn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | login.jsprn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(145) | user loginrn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | dnsguardrn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | login.jsprn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(145) | user loginrn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | loginAction.dorn[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(145) | user loginrn[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select status from users where username ='admin' and pwd = md5('11111111')rn[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryForList(417) | select logintime from nta_log.login_log where account='admin' and onlogin=1 AND logflag=1 and latelyip <>2130706433rn[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | SELECT selectedID FROM nta_conf.permission_group_list t1, dns_web.users t2 WHERE username='admin' and t1.id = t2.group_idrn[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=1rn[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=2rn[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=3rn[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=4rn[DNSGuard] DEBUG [http-8080-1] ActionExceptionHandler.execute(59) | java.lang.NumberFormatException: For input string: ",1,2,3,4,"rn at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)rn at java.lang.Integer.parseInt(Integer.java:447)rn at java.lang.Integer.parseInt(Integer.java:497)rn at com.risinginfo.nta.common.login.action.LoginAction.login(LoginAction.java:92)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)rn at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:75)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.risinginfo.nta.common.filter.Permessionfilter.doFilter(Permessionfilter.java:155)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.risinginfo.nta.common.jcaptcha.JCaptchaFilter.doFilter(JCaptchaFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)rn at java.lang.Thread.run(Thread.java:619) rnpublic String getPermissionGroupID(String username)rn rn String sql = "SELECT selectedID FROM nta_conf.permission_group_list t1, dns_web.users t2 ";rn sql += " WHERE username='" + username + "'";rn sql += " and t1.id = t2.group_id";rn SqlRowSet rowSet = queryRowSet(sql);rn String menu_id = ",";rn if(rowSet.next())rn rn String menu_id_tmp = rowSet.getString("selectedID");rn rn String[] menuArr = menu_id_tmp.split(",");rn for(int i = 0; i < menuArr.length; i++) rn String nodeid = menuArr[i];rn menu_id += nodeid + ",";rn String parSql = "select level from dns_web.menu where nodeid=" + nodeid;rn SqlRowSet rowSet2 = queryRowSet(parSql);rn if(rowSet2.next()) rn int level = rowSet2.getInt(1);rn for(int k = level - 1; k > 0; k--)rn //4级rn String parSql2 = "select parentid from dns_web.menu where nodeid=" + nodeid;rn SqlRowSet rowSet3 = queryRowSet(parSql2);rn if(rowSet3.next())rn String parentid = rowSet3.getString(1);rn menu_id += parentid + ",";rn nodeid = parentid;rn rn rn rn rn rn return menu_id;rn
相关热词 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法 c# gmail 发邮件 c# 多层文件