Post by Gorek on Sept 29, 2004 22:49:52 GMT
Here is some text to make a small bar chart making program took about 20 mins to write and 30 to debug lol lots of mistakes but works fine now lol
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
void main (void)
{
char bar1[10];
char bar2[10];
int bar4;
int read;
int read1;
int bar;
int bar5;
clrscr();
do
{
cout <<"Please Enter The Number For\nBar Number One: Must Be Between One And Twenty\n";
gets (bar1);
read = atoi(bar1);
if (read < 0 || read > 20)
{
cout << "You Have Entered An Invaild Number Please Try Again\n";
}
}
while (read < 0 || read > 20);
clrscr();
do
{
cout <<"Please Enter The Number For\nBar Number Two: Must Be Between One And Twenty\n";
gets (bar2);
read1 = atoi(bar2);
if (read1 < 0 || read1 > 20)
{
cout << "You Have Entered An Invaild Number Please Try Again\n";
}
}
while (read1 < 0 || read1 > 20);
clrscr();
for (bar=1;bar!=read;bar++)
{
gotoxy (1,20 - bar);
cout << char (219);
cout << char (219);
}
for (bar4=1;bar4!=read1;bar4++)
{
gotoxy (4,20 - bar4);
cout << char (219);
cout << char (219);
}
gotoxy (1,21);
cout << read;
gotoxy (4,21);
cout << read1;
gotoxy (1,23);
cout << "Thankyou For Using This Program Goodbye\n";
cout << "Program Written By Stefan Beaumont";
getch();
}
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
void main (void)
{
char bar1[10];
char bar2[10];
int bar4;
int read;
int read1;
int bar;
int bar5;
clrscr();
do
{
cout <<"Please Enter The Number For\nBar Number One: Must Be Between One And Twenty\n";
gets (bar1);
read = atoi(bar1);
if (read < 0 || read > 20)
{
cout << "You Have Entered An Invaild Number Please Try Again\n";
}
}
while (read < 0 || read > 20);
clrscr();
do
{
cout <<"Please Enter The Number For\nBar Number Two: Must Be Between One And Twenty\n";
gets (bar2);
read1 = atoi(bar2);
if (read1 < 0 || read1 > 20)
{
cout << "You Have Entered An Invaild Number Please Try Again\n";
}
}
while (read1 < 0 || read1 > 20);
clrscr();
for (bar=1;bar!=read;bar++)
{
gotoxy (1,20 - bar);
cout << char (219);
cout << char (219);
}
for (bar4=1;bar4!=read1;bar4++)
{
gotoxy (4,20 - bar4);
cout << char (219);
cout << char (219);
}
gotoxy (1,21);
cout << read;
gotoxy (4,21);
cout << read1;
gotoxy (1,23);
cout << "Thankyou For Using This Program Goodbye\n";
cout << "Program Written By Stefan Beaumont";
getch();
}