| | |
Triangle.
Please support our C++ advertiser: Intel Parallel Studio Home
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; 25 Days Ago at 8:22 pm.
Knowledge is earned, Education is learned.- me
•
•
Join Date: Feb 2008
Posts: 629
Reputation:
Solved Threads: 46
0
#4 25 Days Ago
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 25 Days Ago
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 25 Days Ago
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
- 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++)
- Program to display ascending or descending triangle (C++)
- pascals triangle (C++)
Other Threads in the C++ Forum
- Previous Thread: Functions
- Next Thread: counting positive values
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile console conversion convert count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





