Sunday, 8 September 2013

Clear the output screen in my C programm

Clear the output screen in my C programm

INPUT :
/* --------------------INVESTMENT SOLUTION----------------- */
#define PERIOD 10
#define PRINCIPAL 5000
/* ------ MAIN PROGRAM BEGINS ------ */
void main()
{
/* ------ DECLARATION STATEMENTS ------ */
int year;
float amount,value,inrate;
/* ------ ASSIGNMENT STATEMENTS ------ */
amount = PRINCIPAL;
inrate = 0.11;
year = 0;
clrscr();
/* ------ COMPUTATION STATEMENTS ------ */
while(year <= PERIOD)
{
printf("%2d\t%8.2f\n",year,amount);
value = amount + inrate * amount;
year = year + 1;
amount = value;
}
getch();
} /* ------ PROGRAM ENDS ------ */
OUTPUT :
As output comes correct.
PROBLEM
As I want to add clrscr(); to clear the screen. I try to put in different
all possible places but it gives different output like 00.00 or +NULL. So
how can I clear my screen? And why I am not able to add clrscr();
function.

No comments:

Post a Comment