Post: C++ help
06-03-2011, 01:03 AM #1
|C++|
< ^ > < ^ >
(adsbygoogle = window.adsbygoogle || []).push({}); Can you tell me why this:
    #include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
char table[7][7];
for(int d = 0;d<=7;++d)
{
for(int i = 0;i<7;++i)
{
cout<<table[d][i]<<".";
}
cout<< endl;
}
system("PAUSE");
}

looks like this You must login or register to view this content.

---------- Post added at 09:03 PM ---------- Previous post was at 08:43 PM ----------

edit: instead of cout the array of i and d i created b and f(inside the inner nest of the for loop) and i defined both as '.'. but now its all "j"(7 by 7 row of j). at least its not as ugly but its better
FINAL UPDATE: i fixed it now it works
    #include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
char table[7][7];
for(int d = 0;d<=7;++d)
{
for(int i = 0;i<7;++i)
{
table[d][i] = '.';
cout<<table[d][i];
}
cout<< endl;
}
system("PAUSE");
}

(adsbygoogle = window.adsbygoogle || []).push({});
06-05-2011, 01:40 AM #11
Ritztro
I am a Game Developer
Originally posted by SLiiTH3R View Post
aren't you like 1337 at c++???why would you need practice?? lol i guess you had me fooled.ps its supposed to be a dungeon crawler game, you'G' has to get to the end 'X' and avoid enemies'T' that are constantly changing move by move

---------- Post added at 12:44 PM ---------- Previous post was at 12:34 PM ----------

naaah all i had to do is say table[d]= '.'; then cout it. now it all comes out as dots like i wanted it to.

---------- Post added at 12:47 PM ---------- Previous post was at 12:44 PM ----------



no that is pointless all i had to do was set table[d] = '.', then cout it and it all comes out as dots

---------- Post added at 12:53 PM ---------- Previous post was at 12:47 PM ----------

no he is correct that is what i was looking for, im not trying to define every thing in the array im not dumb, but thank you for trying to help


Well I always like to solve problems with my knowledge of the more advanced components of c++ so that I can improve my problem solving skills.
06-05-2011, 01:40 PM #12
|C++|
< ^ > < ^ >
oh, i think i explained it already but any way , your character 'Y' has to make its way out of the dungeon to the exit 'X' and at the same time dodging constantly moving enemies 'T' on the table that i created in this thread.

---------- Post added at 09:40 AM ---------- Previous post was at 09:36 AM ----------

lol its cool

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo