![]() |
![]() |
![]() |
|
![]() 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...
|
![]() |
![]() |
|
Enthusiast ![]() ![]() Joined Nov 21, '05 From Wpg, MB. Canada Currently Offline Reputation: 3 (100%) ![]() |
err. Hurley, your program doesn't make any sense.. from your first post of the problem, this is what I get from it..
Given the width (Wriver), rowing speed (Vrow), and river speed (Vwater), find Ddown, which is the distance you have travelled down from your original location? Where is this waterfall and death coming from. ![]() |
![]() |
|
![]() Enthusiast ![]() ![]() ![]() ![]() ![]() Joined Mar 3, '04 From Portsmouth, RI Currently Offline Reputation: 33 (100%) ![]() |
QUOTE(Starcraftjunkie @ Oct 13, 2006 - 2:11 AM) [snapback]491084[/snapback] err. Hurley, your program doesn't make any sense.. from your first post of the problem, this is what I get from it.. Given the width (Wriver), rowing speed (Vrow), and river speed (Vwater), find Ddown, which is the distance you have travelled down from your original location? Where is this waterfall and death coming from. ![]() lol. yeah theres appeantly a waterfall that you cant go over. like I said, I am confused. heres the instructions for the last part: "You can then print out some results. For example • "Print out" (cout) the values of Ddown and Dwf. • If you did not go over the waterfalls, print out a congratulations such as "you survive". • If you go over the waterfalls, print out a regrets message such as "You hurt."" -------------------- |
![]() ![]() |
Lo-Fi Version | Time is now: August 1st, 2025 - 9:39 AM |