Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 04-04-07   #1 (permalink)
Programmer
 
ravicus's Avatar
 
amd nvidia

Join Date: Oct 2006
Location: North Carolina
Posts: 362

Rep: 20 ravicus is acknowledged by some
Unique Rep: 18
Trader Rating: 0
Default [Source]C++ ASCII Triangle Drawer

:P
I was bored, so I made this C++ Program to draw an ASCII Triangle.

The first time i tried, I just started coding(no plan) and I phailed.

Then i made a plan for the logic and I won
Heres the code

Code:
#include <iostream>
using namespace std;

long userin = 0;
long currentheightcount = 0;
long currentspacecount = 0;
long neededspaces = 0;
long bottomwidth = 0;

void main(void)
{
	//-------------------------------------------------------------------------------------
	cout << "Hello, Welcome to my triangle drawer!\n" << "Please enter a height in | for the program to draw: ";

	cin >> userin;

	cout << "Thank you! Let the drawing begin!\n\n";

	userin--;
	//-------------------------------------------------------------------------------------
	while (currentheightcount < userin)
	{
		cout << "|";
		//---------------------------------------------------------------------------------
		if (neededspaces != 0)
		{
			//-----------------------------------------------------------------------------
		for(currentspacecount; currentspacecount != neededspaces; currentspacecount++)
		{
			 cout << " ";	
		}
		//---------------------------------------------------------------------------------
		}
		//---------------------------------------------------------------------------------
		cout << "\\" << endl;
		currentheightcount++;
		neededspaces++;
		currentspacecount = 0;
	}
	//------------------------------------------------------------------------------------- 
	bottomwidth = neededspaces;
	cout << "|";
	//-------------------------------------------------------------------------------------
	for (bottomwidth; bottomwidth != 0; bottomwidth --)
	{
		cout << "_";
	}
	//-------------------------------------------------------------------------------------
	cout << "\\";
	cout << "\n\n\n";
}
__________________
System: Budget Beast
CPU
A64 3700+ San Diego
Motherboard
Biostar T-Force GeForce 6100 S939
Memory
1 GB G.Skill
Graphics Card
eVGA 7600 GT
Hard Drive
Western Digital 160 GB
Sound Card
SoundBlaster LIVE!
Power Supply
FSP 450 Watt
Case
Mecca w/ see through door
OS
Windows MCE
Monitor
Old Dell CRT
ravicus is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 01:17 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.20106 seconds with 8 queries