Fun Programs :D

Hello Beginners Like me.
I thought that I could give you some programs to do that I used to have a problem with them, because I didn't have the idea on what is the basic structure of the program. Anyway have fun doing them :D.

Program Number 1.

Make a program that will output the shape of a rectangular. The numbers of star on a single side of the square should be an input by the user.

Example

1
2
3
4
5
6
7
Enter The Number of Stars on The Side : 5

*****
*   *
*   *
*   *
*****


Program Number 2.

Make a program that will output the shape of the letter "X". The numbers of star on each diagonal line should be an input by the user.

Example

1
2
3
4
5
6
7
Enter The Number of Stars on The Diagonal Lines : 5

*   *
 * *
  *  
 * * 
*   *


Program Number 3.

Make the following shapes. Also the number of rows should be an input by the user.

1
2
3
4
5
6
7
8
   3.A            3.B

            |            
    *       |         *
   **       |        **
  ***       |       * *
 ****       |      *  *
*****       |     *****


Good Luck.
Mohannad


=EDIT= I forgot to give you a hint for the source codes.
All 4 of them consist of 2 nested for loops, using 2 variables.
Last edited on
Simply out of curiosity, you're not expecting us to just code this then post the source codes on here for you, are you?
I don't want the source codes. I want each one of the beginners to see if he can do this on his own. Thank you for reminding me. No one posts his source here. I have solved the first two examples before. 3.A is easy peasy :D. 3.B I just invented. Hehe

Again Good Luck.
Mohannad
Last edited on
An added challenge: Solve 2 and 3A by recursion!
closed account (42hU7k9E)
Very usefull, thank you.
Program 1 I did my first week in C++ in college.
@Corpus
An added challenge: Solve 2 and 3A by recursion!


That's a bit hard :D. For me I mean. Cuz I still haven't got the full idea of recursion!

@kajzec
Very usefull, thank you.


If that's for me, then no problem buddy. Hope you can do them :D
Last edited on
Topic archived. No new replies allowed.