Skip to content

Instantly share code, notes, and snippets.

@ikariiin
Created July 22, 2015 12:38
Show Gist options
  • Save ikariiin/4b29ea39e0cf292cab9e to your computer and use it in GitHub Desktop.
Save ikariiin/4b29ea39e0cf292cab9e to your computer and use it in GitHub Desktop.
//============================================================================
// Name : Pattern.cpp
// Author : Gourab Nag
// Version : 1.0
// Copyright : None
// Description : Triangular Pattern in C++, Ansi-style
//============================================================================
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void star(int rows);
bool isValid(int input);
int main() {
int noRow;
cout << "Enter The No Of Rows You Wanna Print: \n";
cin >> noRow;
star(noRow);
return 0;
}
void star(int rows)
{
int curRow = 1;
for(int i = 0; i <= rows; i++)
{
cout << setfill('*') << setw(curRow) << "\n";
curRow = curRow + 1;
}
}
bool isValid(int input)
{
if(input <= 10000)
{
return true;
}
else
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment