User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 402,928 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,923 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 2921 | Replies: 3
Reply
Join Date: Dec 2004
Posts: 462
Reputation: Acidburn is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
Acidburn Acidburn is online now Online
Posting Pro in Training

drawing - stickman with array

  #1  
Apr 5th, 2005
Hello,

as you well know I've got a hangman game produced, I now have the luxury of adding to the code since all my work is completed ...yay, well, I've decieded to take it a step further and draw out the hunged man! I have the drawing , its just putting it into an array... Anyone offer suggestions?
to prove I'm working heres a sample code:

#include <iostream>

using namespace std;

int main()
{
   char array[10] ="_____";
   char array2[10] = "||||";

for(int i =0;  i < 3 ;i++)
{
cout << array[i];
}
cout << endl;
for ( i = 0; i < 3 ; i++)
{
cout << array2[i] <<endl;
}
return 0;
}

just wondering if my way im working on is the best for now?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: Devon - UK
Posts: 420
Reputation: 1o0oBhP is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: drawing - stickman with array

  #2  
Apr 7th, 2005
Have an array of chars and draw it!

eg:

char array[] =    { "+", "+", "+", "+", "+",
                         "+", "0", "+", "0", "+",
                         "+", "+", "^", "+", "+",
                         "+", "_", "+", "_", "+",
                         "+", "+", "-", "+", "+" };

int s = sizeof(array) / sizeof(char);

for(int i = 0; i < s; i++)
    cout << array[i];
cout << "\n";

draws a simple smiley face!
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote  
Join Date: Dec 2004
Location: Devon - UK
Posts: 420
Reputation: 1o0oBhP is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: drawing - stickman with array

  #3  
Apr 7th, 2005
Have an array of chars and draw it!

eg:

char array[] =    {      "+", "+", "+", "+", "+",
                         "+", "0", "+", "0", "+",
                         "+", "+", "^", "+", "+",
                         "+", "_", "+", "_", "+",
                         "+", "+", "-", "+", "+" };

int s = sizeof(array) / sizeof(char);

for(int i = 0; i < s; i++)
    cout << array[i];
cout << "\n";

draws a simple smiley face!

sorry for repost, was supposed to be an edit!
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote  
Join Date: Dec 2004
Posts: 462
Reputation: Acidburn is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
Acidburn Acidburn is online now Online
Posting Pro in Training

Re: drawing - stickman with array

  #4  
Apr 7th, 2005
when I attempt to run it i get an error "To mnay intilizers, but when I change the " to ' it runs but doesnt print on sepearte lines ?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 4:52 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC