What do you have so far (for the code)? Hint: You'll need to use "for."
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 583
Skill Endorsements: 11
I think I know what you want to do, you want to print the char '*' but make them it print in a form of a square?
Like so:
*****
*\\\\\*
*\\\\\*
*****
Where the '\'s are blank space (multi spaces are not supported here I presume)
For that you would have to use a for loop
What I would do is the following:
I would have a string showing what I would want to print, and have key charectars showing where to end the line and where to show background etc.
const string box = "****************$"+
"*//////////////*$"+
"*//////////////*$"+
"*//////////////*$"+
"*//////////////*$"+
"****************$"+
for(int i=0; i < box.Length; i++)
{
if(avatar[i]!='/'){
Console.ForegroundColor = ConsoleColor.Blue;
if(box[i]=='$'){Console.ForegroundColor = ConsoleColor.Green;Console.WriteLine("/");}
else{Console.Write(box[i]);}
}
else{Console.ForegroundColor = ConsoleColor.Green;Console.Write("/");}
}
Try that
NargalaX
Junior Poster in Training
69 posts since Aug 2009
Reputation Points: 18
Solved Threads: 1
Skill Endorsements: 0
Oops! Im sorry, I wrote one variable wrong in the code.
Here is a fixed version :
const string box = "****************$"+
"*//////////////*$"+
"*//////////////*$"+
"*//////////////*$"+
"*//////////////*$"+
"****************$"+
for(int i=0; i < box.Length; i++)
{
if(box[i]!='/'){
Console.ForegroundColor = ConsoleColor.Blue;
if(box[i]=='$'){Console.ForegroundColor = ConsoleColor.Green;Console.WriteLine("/");}
else{Console.Write(box[i]);}
}
else{Console.ForegroundColor = ConsoleColor.Green;Console.Write("/");}
}
NargalaX
Junior Poster in Training
69 posts since Aug 2009
Reputation Points: 18
Solved Threads: 1
Skill Endorsements: 0
You need a for loop over all of the rows, a for loop for each row (with an if statement to switch from printing spaces to printing stars (so at column a and column b I need a star, the rest I need spaces)). It sounded like you had a lot of it, just put some " " spaces in where appropriate.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 583
Skill Endorsements: 11
shank123,
Thanks for helping the poster. However, in the spirit of truly helping posters with their homework, it's best not to give the answer away completely.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 583
Skill Endorsements: 11