I'd be embarrassed to tell anyone how long it took me to get this far, since about 8pm last night! I have been assigned some homework to code a program that produces output in a diamond shape on screen with one user input, how many lines. I managed the triangle, centered triangle but the diamond's logic is very difficult, for me. Second term student at DeVry, six weeks since 'Hello World'. Anyone point me in the right direction>? Joe...here's what I've come up with so far, the upper half of diamond compiled, and one of this weeks three assignments. Thanks
#include <iostream>
using namespace std;
int main()
{
//variables
int dots = 0;
//process
cout << "Centered triangle program" << endl << endl;
cout << "Enter number of lines you would like in triangle up to 40: ";
cin >> dots;
cout << endl;
//for loop providing initial argument
for (int dot = 1; dot <= dots; dot = dot + 1)
{
//nested loop
for (int skip = 0; skip <= (dots-dot); skip = skip + 1)
{
cout << " ";
}
//nested loop
for (int asterick = 0; asterick < (dot*2)-1; asterick = asterick + 1)
{
// output
cout << "*";
}
//end line
cout << endl;
}
system ("pause");
return 0;
}
I've been reading a lot of the threads and am not sure I know enough to even be posting here.