Hello all so I'm in my first year of college and we have to make several programs that print a flag, I've succeeded printing all the programs but two.
So I created a menu in my main() where the user can chose which flag he wants, he also gives the heigth and the two symbols he wants to display.
We have knowledge of functions, while, switch, for, do while, some standard libraries, ... so far. So nothing really advanced yet.
The flags i need to display are:
#ooooookkkkkk
#ooooookkkkkk
#ooooookkkkkk
#kkkkkkkooooo
#kkkkkkkooooo
#kkkkkkkooooo
#
#
#
#
#
#
and
#kkkkookkkk
#kkkokkokkk
#kkokkkkokk
#kokkkkkkok
#okkkkkkkko
#
#
#
#
#
#
an example for another flag I made (so that you know what my knowledge so far is):
#************
#************
#kkkkkkkkkkkk
#kkkkkkkkkkkk
#TTTTTTTTTTTT
#TTTTTTTTTTTT
#
#
#
#
#
This is my code (this one works):
translation for the words: symbool=symbol and hoogte=heigth.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
void hVlag(char symbool1, char symbool2, int hoogte)
{
for (int i = 1; i <= hoogte; i++)
{
if (i <= hoogte/ 2)
{
for (int x = 0; x <= hoogte * 2; x++)
{
if (x==0)
{
cout << "#";
}
cout << symbool1;
}
cout << endl;
}
else
{
for (int x = 0; x <= hoogte * 2; x++)
{
if (x==0)
{
cout << "#";
}
cout << symbool2;
}
cout << endl;
}
}
for (int x = 1; x <= hoogte; x++)
{
cout << "#\n";
}
}
|
Would be great if someone could help me with the two other flags :D.