drawing - stickman with array

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2004
Posts: 489
Reputation: Acidburn is an unknown quantity at this point 
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

drawing - stickman with array

 
0
  #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:

  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char array[10] ="_____";
  8. char array2[10] = "||||";
  9.  
  10. for(int i =0; i < 3 ;i++)
  11. {
  12. cout << array[i];
  13. }
  14. cout << endl;
  15. for ( i = 0; i < 3 ; i++)
  16. {
  17. cout << array2[i] <<endl;
  18. }
  19. return 0;
  20. }

just wondering if my way im working on is the best for now?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: drawing - stickman with array

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

eg:

  1.  
  2. char array[] = { "+", "+", "+", "+", "+",
  3. "+", "0", "+", "0", "+",
  4. "+", "+", "^", "+", "+",
  5. "+", "_", "+", "_", "+",
  6. "+", "+", "-", "+", "+" };
  7.  
  8. int s = sizeof(array) / sizeof(char);
  9.  
  10. for(int i = 0; i < s; i++)
  11. cout << array[i];
  12. 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 Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: drawing - stickman with array

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

eg:

  1.  
  2. char array[] = { "+", "+", "+", "+", "+",
  3. "+", "0", "+", "0", "+",
  4. "+", "+", "^", "+", "+",
  5. "+", "_", "+", "_", "+",
  6. "+", "+", "-", "+", "+" };
  7.  
  8. int s = sizeof(array) / sizeof(char);
  9.  
  10. for(int i = 0; i < s; i++)
  11. cout << array[i];
  12. 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 Quick reply to this message  
Join Date: Dec 2004
Posts: 489
Reputation: Acidburn is an unknown quantity at this point 
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

Re: drawing - stickman with array

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC