![]() |
![]() |
![]() |
|
![]() 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 Mar 3, '04 From Portsmouth, RI Currently Offline Reputation: 33 (100%) ![]() |
yeah I got that far (not sure if it'll work yet). its the end where you tell it to say 'you survive' if you dont go over the waterfall or 'you die' if you go over that I am stuck on.
heres what I have so far, I know there are things wrong: #include <iostream> #include <cmath> using namespace std; int main () float ddown, wriver, vwater, vrow, dwf; cout << endl << "Enter value of width of the river"; cin >> ddown; ddown=(wriver*(vwater/vrow)) do { if ; done='y'; } while (done='y'); cout << endl << "Congrats! You Survive."; { if ; done='x'; } while (done='x'); cout << endl << "Ouch! You have drowned."; return 0; } -------------------- |
![]() ![]() |
Lo-Fi Version | Time is now: July 27th, 2025 - 2:18 PM |