C++ Funtion help
Posted: Wed Jan 18, 2006 4:43 pm
Hi
i was wondering if it is posible for my code (below) to run the Star() function in the background so i can have the moving character and still print text.
(p.s if the codes bad im sorry ive only just bin doin c++ for 3 months and im a slow learner lol)
i was wondering if it is posible for my code (below) to run the Star() function in the background so i can have the moving character and still print text.
(p.s if the codes bad im sorry ive only just bin doin c++ for 3 months and im a slow learner lol)
Code: Select all
#include <iostream.h>
#include <windows.h>
using namespace std;
void printstar(int x,int y,char character)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
cout << character;
system("cls");
}
void Mvstar(int innerlimit,int outerlimit,int hight,char character)
{
int innerlimit2 = innerlimit;
do{
printstar(innerlimit,hight,character);
innerlimit++;
}while(innerlimit != outerlimit);
do{
printstar(outerlimit,hight,character);
outerlimit--;
}while(outerlimit != innerlimit2);
}
void Star(int innerlimit,int outerlimit,int hight,char character)
{
bool star = true;
do{
Mvstar(innerlimit,outerlimit,hight,character);
}while(star == true);
}
int main()
{
Star(1,75,10,'*'); //innerlimit, outerlimit, hight(depth), character
system("pause");
}
[code]
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:4107, old post ID:33644[/size][/color]