![]() |
| ||
| Program Compiles, and excecutes but crashes when run. 1 Attachment(s) Hey guys, I have been working on this program for my entire semester. I got it down to do what I want I think... except when I compile it, I get no errors or warnings (using Dev) and when I execute it runs through half of it and it stops and gives me a error saying the program stopped responding. I tried debuging it but I don't know what it's telling me when it sends me to a if loop. Anyone have any suggestions, the program is displayed below and the text file is attached. #include<iostream> //File input/ouput include files here is the text, it's also attached 1 2 2 4 1 3 3 7 2 4 2 6 2 5 6 8 2 6 8 8 3 2 5 5 3 5 3 8 3 8 5 9 4 3 2 4 4 5 3 4 4 6 3 9 4 7 1 5 5 7 6 4 5 8 1 2 7 6 1 5 8 7 2 9 |
| ||
| Re: Program Compiles, and excecutes but crashes when run. Your program is experiencing out-of-bounds errors. The arrays are allocated 17 elements numbered 0-16 and your program is attempting to write to elements 1-17. Element #17 does not exist. Learn to count the C and C++ way -- with 0 as the base value. Your program is chuck full of buffer overruns and out-of-bound errors. |
| ||
| Re: Program Compiles, and excecutes but crashes when run. I thought i accounted for that though, by having i start at 1 in every itteration. I don't understand what I'm suppose to do to change it. I tried looking through the program and I don't have anything that seems that it wouldn't work. I tried changing the const instead of 16 to 15, and the nodes from 8 to 7, and then vise versa up to 17, and 9, and still having the same thing happening... |
| ||
| Re: Program Compiles, and excecutes but crashes when run. When I try to debug it, it points to this line but I don't know what's wrong w/ it... for (i = 1; i<= NUMARCS+1; i++) |
| ||
| Re: Program Compiles, and excecutes but crashes when run. Quote:
for (i = 0; i< NUMARCS+1; i++) |
| ||
| Re: Program Compiles, and excecutes but crashes when run. I did, I tried changing all the 1's to 0's also, that didn't help, then I tried leaving them at 0's and bring down the numbers of everything that didn't work tried bringing it up.. I honestly can't figure it out tried singling out stuff and same problem. It isn't pointing at the for, it's pointing at the if, i tried changing that 0 to 1 also. I honestly can't think anymore spent about eight hours writing this today with all the errors and i can't get it to work |
| ||
| Re: Program Compiles, and excecutes but crashes when run. it's telling me it's unable to handle exception when it poitns to that if statement |
| ||
| Re: Program Compiles, and excecutes but crashes when run. Holy crap I solved it guys!!! Thank you sooooooooo much the program works!!! All I had to do was take out the +1 on for (i = 1; i< NUMARCS+1; i++) and change it too for (i = 0; i< NUMARCS; i++) I can't thank you guys enough really honestly, I freaking love Daniweb! |
| All times are GMT -4. The time now is 9:21 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC