I am making a diamond by inputting the odd number between 1 to 10

I finished the code except  making it like a diamond shape. any help?

#include <iostream>
 
using namespace std;
 
 int main()
 {
	 int oddnumb;
	 do
	 {
	 cout << "type your oddnumber";
	 cin >> oddnumb;
	 } while(oddnumb>=1 && oddnumb %2 != 1 &&oddnumb <10);
	 
	int star,numb;
	 for (star =1; star<=oddnumb ; star+=2) //for 1,3,5
	{
		
		 for (numb = 1 ; numb <=star; numb++) 
		{
		
			cout<<"*";
		} cout << endl;
	 }
	
	for(star = oddnumb-2; star>=1; star-=2)
	{
		for(numb = star; numb>=1; numb--)
		{
			cout << "*";
		}
		cout << endl;
	}
 
 system("pause");
	
 }

Open in new window

jiwonmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Infinity08Commented:
Well, you'll have to add a few spaces at the beginning of certain lines ... The amount of spaces you have to place is a function of the loop index numb ...

Think about it a bit, and give it a try ...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jiwonmanAuthor Commented:
got you. :) thank you.
0
Infinity08Commented:
May I ask why you gave a B grade ? That usually means that something was missing in the answer. If something is still not clear, then please ask about that, and I'll be happy to help you further :)
0
jiwonmanAuthor Commented:
I am sorry, it's my first time using this website. I didn't know what to click. I was working on different projects( trying to learn as many as I can, I am currently working on matrix multi one. it's really tough for me..). Anyways, the answer was A++. I'm sorry for that.
0
Infinity08Commented:
No problem ... I just wanted to make sure that you were helped ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.