C++/c++

Advertisement


Question
c++ code to print triangle, pyramid, parallerogram, using star




         ****
         ******
         ********
         **********
         ************


Answer
Hello dauda gadu, thanks for the question.

This is actually a very easy problem to solve. For the triangle I'll show an example:

cout << "***\n";
cout << "******\n";
cout << "********\n";

// and so on....

Console projects and cout make doing things like this rather easy. In the case of a parallelogram, you would combine the use of spaces and escape sequences(\t) to do it.

I hope this information was helpful.

- Eddie  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Eddie

Expertise

I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.

Experience

I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.