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);
}

Recommended Answers

All 4 Replies

help please?

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

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?

A question off-topic

#include<iostream.h>

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

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.