Triangle Problem

blah
Last edited on
1
2
3
for(int i=0 ; i<0; i++) //loop for vertical                                                            
    {
      for(int j=0;j<0;j++) //loop for horizontal       


Uhm... your loops run 0 times?
...
Last edited on
You'd have to tell it not to run 0 times.

1
2
for(int i=0 ; i<0; i++) // i = 0, and you are telling it to run until i is less than 0, which it already                                                                           
 // is to begin with (i < 0). Change the 0 to however many times you want it to run    

Last edited on
I go to the worst school and have the worst teacher, she doesn't care, she does her job and goes home. She might've been a good teacher but now she's just a shell. Those who can't do, teach. But teaching should come from a place of caring. She just doesn't.
I know, no one cares. But I came on here to try to get some help and I didn't. I'll learn on my own, and if I don't get it and I fail, then I'll try again.
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
int num;
	char sym;
	
	cin >> num; 
	cin >> sym;

	cout << endl;

	for (int i = 0; i < 6; i++)
	{
		for (int j = 0; j < num; j++)
		{
			cout << sym << " ";
		}
		
		cout << endl;
		num--;
	}


There you go buddy. $ is not an integer, its a character so you have to use char sym;
Last edited on
Topic archived. No new replies allowed.