Can someone help shed some light on what I'm doing wrong? I'm trying to create the following diamond which the size is determined by the user's input:
*
***
******
***
*
When I try to compile my program, I get the error parse error at the end of input. Here's my code so far:
#include <iostream>
#include <stdlib.h>
#include <iomanip>
int main()
{
int size;
int i;
int j;
int k;
cout << "Enter size: 1-80" << endl;
cin >> size;
if (size > 0 && size < 80)
{
for (int i = 0; i < size; i++)
{
int j = i++;
for (; k!= 0; k--)
{
cout << '*';
}
cout << endl;
for (i = size; i > 0; i--)
{
int j= --i;
for (; k!= 0; i--)
{
cout << '*';
}
cout << endl;
}
for (int k = 1; k <= 5; k++)
{
cout << setw(k) << ' ';
for (int j = k; j <= 5; j++)
cout << "*";
cout << endl;
system("PAUSE");
return 0;
}
I would really appreciate the assist!
Thanx



LinkBack URL
About LinkBacks



