Oct 12, 2006 - 2:04 AM
|
|
![]() Administrator ![]() ![]() ![]() ![]() ![]() Joined Aug 23, '02 From Seattle, WA Currently Offline Reputation: 14 (100%) |
I've been writing a program for class and was getting strange errors,
so I went through everything and eventually simplified it down to this super-simple program: CODE #include <iostream> using std::cout; using std::cin; int main() { int buckets[9][4] = {0}; for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 4; k++) { cout << buckets[j][k] << " "; } cout << "\n"; } char ch; cin >> ch; } Sounds simple, right? Create a 10 row, 5 column 2-dimensional array filled with zeroes, right? The problem is that my output is this: Anyone have any idea as to what could be going on? If I manually fill the array with zeroes using two for loops, I get the correct output, but when the program tries to exit after I enter a character, I get this error: Any of you programmers out there have any ideas?
Attached image(s)
-------------------- New Toyota project coming soon...
|
![]() |
Oct 12, 2006 - 11:33 PM
|
|
|
Enthusiast ![]() Joined Jul 19, '06 From Colorado Currently Offline Reputation: 0 (0%) |
< Pulls out hair <_<
I prefer Delphi as it is so much easier, but when I get into code I can read it like a book. But I just hate it. I was kicked out of class in school when I coded a checksum error and check that would lock and consume all the resources on a PC in a couple seconds. This was in the late 90's though. I was gonna make a script to run it on boot, and to distribute it to the 9X registry through allowed shares. The teacher didn't think that it was funny. And thus ended my schooling in C++. |
Oct 12, 2006 - 11:40 PM
|
|
|
Enthusiast ![]() ![]() ![]() ![]() Joined Dec 9, '05 From Long Beach Currently Offline Reputation: 1 (100%) |
QUOTE(Steevo @ Oct 12, 2006 - 9:33 PM) [snapback]491046[/snapback] < Pulls out hair <_< I prefer Delphi as it is so much easier, but when I get into code I can read it like a book. But I just hate it. I was kicked out of class in school when I coded a checksum error and check that would lock and consume all the resources on a PC in a couple seconds. This was in the late 90's though. I was gonna make a script to run it on boot, and to distribute it to the 9X registry through allowed shares. The teacher didn't think that it was funny. And thus ended my schooling in C++. lmao yup hackers are always kids lmao! i remember my computer teacher, he had a program that didnt let us get internet til he enabled it, lol i wrote a visualbasic code and i got internet and everyone else wass like oh damn how u do that lmao i dun think it wass visual basic. ohhh now that i thnk of it it was more of a .bat file. -------------------- Is this good enuff 4 ya? :D
![]() |
Coomer Anyone know C++? Oct 12, 2006 - 2:04 AM
hurley97 when I put that in and ran the program I got essen... Oct 12, 2006 - 3:21 AM
JonCars17 I asked a net friend of mine and this is what he s... Oct 12, 2006 - 6:32 AM
Rjb23 QUOTE(JonCars17 @ Oct 12, 2006 - 11... Oct 12, 2006 - 8:55 AM
phonex98 I agree with Jon. Its been a while since ive done ... Oct 12, 2006 - 8:37 AM
Starcraftjunkie x2. Initalize with the [10][5] and it should be f... Oct 12, 2006 - 12:05 PM
phonex98 im pretty sure he's using the cin (input) as a... Oct 12, 2006 - 9:38 AM
Coomer Awesome...that worked. Thanks a ton guys. Oct 12, 2006 - 12:17 PM
tomazws wow... haven't seen a C++ code for quite a whi... Oct 12, 2006 - 3:21 PM
hurley97 speaking of which... I should be writing a program... Oct 12, 2006 - 3:34 PM
Starcraftjunkie Coomer is using buckets as a variable name. He ca... Oct 12, 2006 - 8:27 PM
hurley97 ahh. the use of "int" confused me, I jus... Oct 12, 2006 - 10:49 PM
phonex98 QUOTE(hurley97 @ Oct 12, 2006 - 8:49... Oct 13, 2006 - 12:08 AM
XS4lv1Truch0x lmao i thought visual basic wass bad now im lookin... Oct 12, 2006 - 11:14 PM
hurley97 yeah I got that far (not sure if it'll work ye... Oct 13, 2006 - 12:48 AM
Starcraftjunkie err. Hurley, your program doesn't make any sen... Oct 13, 2006 - 1:11 AM
hurley97 QUOTE(Starcraftjunkie @ Oct 13, 2006 - 2... Oct 13, 2006 - 1:15 AM
Starcraftjunkie o ya.. make sure you have a line to check the inpu... Oct 13, 2006 - 1:17 AM
hurley97 QUOTE(Starcraftjunkie @ Oct 13, 2006 - 2... Oct 13, 2006 - 1:18 AM
Starcraftjunkie ez. Just use an IF loop.
you calculated your Ddo... Oct 13, 2006 - 7:56 AM
Rjb23 What is a if loop and why would you need a loop?
... Oct 13, 2006 - 8:13 AM
hurley97 31 errors
#include <iostream>
#include ... Oct 13, 2006 - 9:42 AM
tomazws CODE
#include <iostream>
#include <cma... Oct 13, 2006 - 11:40 AM
hurley97 hey thanks! that helped A LOT!
now hopef... Oct 13, 2006 - 2:00 PM
Starcraftjunkie Is the Dwf provided by the question? or do you hav... Oct 14, 2006 - 12:19 AM
hurley97 it wasn't provided but it didn't say to as... Oct 14, 2006 - 7:33 PM![]() ![]() |
| Lo-Fi Version | Time is now: November 25th, 2025 - 5:22 PM |