I have been trying for about 6 hours to get this program to work. It's a C++ program for for loops. I am trying to go through a book, but I don't have source code for how this should be. I need to make a program that looks like this below:

+ = are to show open space


*++++++++++**********+**********++++++++++*
**+++++++++*********+++*********+++++++++**
***++++++++********+++++********++++++++***
****+++++++*******+++++++*******+++++++****
*****++++++******+++++++++******++++++*****
******+++++*****+++++++++++*****+++++******
*******++++****+++++++++++++****++++*******
********+++***+++++++++++++++***+++********
*********++**+++++++++++++++++**++*********
**********+*+++++++++++++++++++*+**********


So far I got the code below, but have no clue what to do from here. Any help would be greatly appreciated. Thank You!!!!!

#include <iostream>
#include <conio.h>
using namespace std;
int main ()
{
	int i,j;

	for (i=1; i<=10; i++)
	{
		for (j=0; j<i; j++)
			cout << "*" ; 
		cout << endl; 
	}
		for (i=10; i>=1; i--)
	{
		for (j=0; j<i; j++)
			cout << "*" ; 
		cout << endl; 
	}


	cout << "any key..." << endl; 
	_getch();
	return 0;
}

Try looking at the code below..You should be able to finish it with this hint..

#include <iostream>

int main(int argc, char *argv[])
{
    int count_one = 1;
    int count_two = 10;
    for (int i = 0; i < 10; ++i)
    {
        for (int j = 0; j < count_one; ++j)
        {
            std::cout << '*';
        }
        for (int j = 0; j < count_two; ++j)
        {
            std::cout << '+';
        }
        ++count_one;
        --count_two;
        std::cout << std::endl;
    }
    return 0;
}

Thank you so much. That helped a ton. Thanks!!!!!!! I hope you have a wonderful day and a great upcoming week. Thanks again!

// a programme that prints triangle of stars
# include<constrea.h>
void main()
{
clrscr();
for(int a=5;a>=1;a--)
{
for(int b=1;b<=a;b++)
{
cout<<" ";
}
for(int c=6;c>=b;c--)
{
cout<<"*";
}
cout<<endl;
}
getche();
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.