0

hi can someone helped me in my triangle ><?
my prof told me to make a program that ask the user to input the height of the triangle and the user must be able to input the height..
and the triangle must be a triangle not a right triangle..
this are my codes but it's lacking one for loop idk what to put in that for loop T^T..please help me ><
code:

#include<iostream.h>
void main()
{
    int a,b=1,c,d,r=1;
    do {
        cout<<"please input the height of the triangle"<<endl;
        cin>>a;
        for(a; a>0; a--) {
            for(c=b; c>0; c--) {
                cout<<a;
            }
            b=b+1;
            cout<<endl;
        }
        cout<<"do you want to repeat the program? enter 1 if yes and 2 if not"<<endl;
        cin>>r;
    }
    while(r==1);
}

Edited by Narue: added code tags and formatting

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by gerard4143
0

please use only this library cause I don't know how to use other libraries ...

0

help please?

You think people live here? We'll get to your problem when we get to it.

please use only this library cause I don't know how to use other libraries ...

What library? I don't see any library!

What are you supposed to do about the width and 1 angle (required for a triangle)?
Or 2 angles (can also define a triangle)? Just make them up?

0

A question off-topic

#include<iostream.h>

What examples/materials are you using that recommend iostream.h?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.