Tuesday 13 August 2013

Hollow Right Angled Triangle 1

Hollow Right Angled Triangle in C++ 1:

In this post of shapes in c language, you will find the code for constructing a Hollow bottom left right angled triangle in C++ using "*". 

Purpose of this code of shapes in c:

The main purpose of this code is to help our visitors to understand how, to use simple programming tools of C++ to draw shapes .
The codes we post are meant to:
  • Help our visitors in designing simple shapes in c language.
  • Make them aware how to make easy shapes using loops.
  • Helping them out for their different assignments.

Advantages of this code of shapes in c:

After studying this code you will be able to:
  • Easily understand the use of nested loops.
  • Appropriate use of If Else conditions.
  • Make a generic codes to make triangles of any desired size(// within the size limit of the console).
  • A clear cut help in designing similar problems.

For more visit: triangle programs in c.

Code:

/*              Join us at
http://shapesinc.blogspot.com 
for more codes of shapes                            
*/
#include<iostream>
using namespace std;
int main()
{
cout << "Join http://shapesinc.blogspot.com for more codes of shapes\n\n";
 cout<<"CAUTION:   The input should not be other than numerical values \n\n\a";  
int size=0;
cout << "Enter the size of the hollow triangle\n";
cin>>size;
for(int i=0 ; i<=size ; i++)
{
for(int j=0 ; j<=i ; j++)
{
if(i!=size)
{
if(j==0 || j==i)
cout<< "* ";
else
cout<<"  ";
}
else if (i==size )
cout<< "* ";
}
for(int spaces=i ; spaces<size ; spaces++)
cout<<"  ";
cout<<endl;
}
}  

Disclaimer:

We do not appreciate the submission of our codes in your final assignments.These codes are meant to help you out to draw complex shapes and provide you with a sense how to deal with such problems.Shapes in c will not take any responsibility for any sort of plagiarism case if you copy pasted our code in your final assignments.




Output:




Right-Angled-Triangle-Shapes-in-c


0 comments:

Post a Comment