| | |
Triangle.
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
I have to print a triangle in C++ where the length is double the height and base of the triangle it is to be isosceles
this is my Isosceles code. how do I change the length base and width so that the length is double. We are only allowed to use stuff up to for loops nothing too fancy. Thank you!
this is my Isosceles code. how do I change the length base and width so that the length is double. We are only allowed to use stuff up to for loops nothing too fancy. Thank you!
C++ Syntax (Toggle Plain Text)
#include <stdio.h> int main(void) { int i; for (i = 0; i < 1; ++i) { printf(" *\n" " *\n" " **\n" " ***\n" " ****\n" " *****\n" " ******\n" " *******\n" " ********\n" " *********\n" " **********\n" } return 0; }
Knowledge is earned, Education is learned.- me
I know i have to declare the Variables height base and length
C++ Syntax (Toggle Plain Text)
int i, base, hieght, length for (i = 0; i< 1; ++1) { printf("*\n" "hieght= 10" "base= 10" "length= 20"}
Last edited by jjf3rd77; Nov 5th, 2009 at 8:22 pm.
Knowledge is earned, Education is learned.- me
•
•
Join Date: Feb 2008
Posts: 638
Reputation:
Solved Threads: 46
0
#4 Nov 5th, 2009
Here you have declared the variables, but then output just constant expressions...
I'd suggest googling for "basic c++" and trying some of the simple examples you find until you get familiar with the basics. Then you can try to write this triangle program as a demonstration to yourself that you've learned something!
Dave
I'd suggest googling for "basic c++" and trying some of the simple examples you find until you get familiar with the basics. Then you can try to write this triangle program as a demonstration to yourself that you've learned something!
Dave
0
#5 Nov 5th, 2009
Well i know how to do basic programming, I am in a class. I just do not know what to do next. Hence why I am asking on the forum. They are always my last resort. That is exactly what I do, I do basic programs first and then I elaborate on those. But I am entirely lost on where to go from my basic triangle program.
Knowledge is earned, Education is learned.- me
0
#6 Nov 5th, 2009
Like this?
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { int dimension, number=0; cout << "Please enter a number, so I may calculate the size of your triangle: "; cin >> dimension; for(int x=0;x<=dimension;x++) { for(int x=0;x<number;x++) cout << "*"; cout << endl; number++; } cout << endl; }
![]() |
Similar Threads
- Program to display ascending or descending triangle (C++)
- Help With Pascal's Triangle in C++ (C++)
- Need a simple, basic TRIANGLE.H example ASAP (C)
- Help with a triangle shape (C++)
- need help with programing with fstream to find area of triangle (C++)
- pascals triangle (C++)
Other Threads in the C++ Forum
- Previous Thread: Functions
- Next Thread: counting positive values
Views: 262 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting spoonfeeding string strings struct temperature template templates text tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





