Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board Create Triangle With Simple For Loop Download Source Code
Author Details Code Information
mikeMarek ( Mike Marek )

Pinned 2 Codes
Posted 5 Coding Articles

Send A Message
View Coders Profile
Language C++
Expires Never
Length 524 Characters (14 Lines)
Password no password
Description

Create a triangle using some variables and a simple for loop: with explanations! :O
  1. //Create-A-Triangle
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() { //initiates our main function
  7.           int numLoops = 25; //our number 'numLoops' equals 25
  8.           string a = "@"; //our string 'a' equals "@"
  9.           string holder = "@"; //our string 'holder' equals "@"
  10.           for (int i(0); i < numLoops; ++i) { //initiates our for loop
  11.                     cout << holder << endl; //outputs 'holder' and adds new line
  12.                     holder = holder + a; //adds our value 'a' to 'holder'
  13.           } //closes our for loop
  14. } //closes our main function
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
 
VBAssassin     Posted 242 Days Ago
 
 
Haha, nice and simple. Think this would be cool as a source code on your profile with
a screenshot and stuff, as opposed to a pinned code (code snippet). Nice work though,
and keep up the commenting on your codes ;-)

Kind regards,
Scott
Page 1 of 1
 
 
Part of the MyPingle Network
Development Blog :: Make A Donation :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved