need help in doing something
Aug 2, 2012 at 2:38pm UTC
i'm just starting to understand c++ and i need to make an image of 321 using "*" this can anyone help me? thanks
Aug 2, 2012 at 3:18pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
int main()
{
std::cout <<
" \
******** ********* * \n \
* * * \n \
******** ********* * \n \
* * * \n \
******** ********* * \n" ;
}
Aug 2, 2012 at 3:28pm UTC
thnx for the reply...but i need to use loop for this, brute force is not recommended. its kinda like I need to display 3 then clear screen 2 then clear again then display 1...
Aug 2, 2012 at 4:08pm UTC
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
for (int i = 3; i > 0 ; i--){
switch (i){
case 1:
cout <<
" \
* \n \
* \n \
* \n \
* \n \
* \n" ;
break ;
case 2:
cout <<
" \
********* \n \
* \n \
********* \n \
* \n \
********* \n" ;
break ;
case 3:
cout <<
" \
******** \n \
* \n \
******** \n \
* \n \
******** \n" ;
break ;
default :
break ;
}
}
Topic archived. No new replies allowed.