I have been wrestling with this code for one year, I no longer have an infinite loop, but I also do not have a diamond either, something is wrong but I dont know what.
half = number/2;
if(number % 2 == 0)
{
number=(half * 2 ) + 1;
}
line = 0;
charsToPrint = 1;
spacesToPrint= half;
while (!(line == half))
{
cout << spacesToPrint << character << '\n';
spacesToPrint--;
character+2;
line++;
}
while (line == half)
{
cout << line << character << '\n';
line++;
spacesToPrint++;
}
while (!(line >= number))
{
line++;
charsToPrint-2;
spacesToPrint++;
cout << spacesToPrint << character << '\n';
}



LinkBack URL
About LinkBacks



