PRINT STARS

Hello everyone, am new to C++, and i have this question : write a program that prompts the user to enter a positive integer number and a character. The programe prints three triangles of stars separated by the entered character, Each trangle should have a number of star lines equal to the entered integer.

And this is my code:


#include<iostream>
using namespace std;
int main()
{
int row;
char ch;
int i,star;

cout<<"Enter number of lines: ";
cin>>i;

cout<<"Enter a character separator:"<<'\t';
cin>>ch;

for(row=1;row<=i;row++)
{
for(star=1;star<=row;star++)
cout<<"*";
cout<<'\t'<<ch;

for(star=1;star<=row;star++)
cout<<"*";
cout<<'\t'<<ch;

for(star=1;star<=row;star++)
cout<<"*";
cout<<endl;

}

}

but its not correct. can some one give me a hint ?
and thank you
Topic archived. No new replies allowed.