Hey guys,
I justs started this code to make a diamond with stars (*), but I get confused how to print the spaces that I need, I don't know if you understant what I'm trying to say. It is something like this:
Prompt the user to enter (odd) height (of a diamond) and outputs the following:
Example height = 7
Output:
*****
******
*******
********
*******
******
*****
and this is the code I'm working on, it is very basic but I'm struggling finding the mistakes and that is just the top part of the diamond:
#include <iostream>
#include <string>
using namespace std;
int main(){
int h; //height
cout<<"Enter any positive number: ";
cin>>h;
int str = 1; //stars
int spc = h/2; //space
for(int k=0; k<str; k++){
cout<<"*"<<endl;
for(int i=0; i<spc; i++)
cout<<" "<<endl;
str = h/2+1;
spc--;
}
system("PAUSE");
return 0;
}