If your program requires ncurses, then your teacher will need ncurses in order to compile it.
You don't need a special library to do some line clearing of the screen, anyway. If you move the cursor to the first char of the row you want to erase, and print out 80 char's of ' ', then the line will be cleared.
To move the cursor you can:
1) include <conio.h> and use gotoxy(x,y) (Which Dev C may not support since it's non Standard).
2) In Windows, you use SetConsoleCursorPosition(), This is an example showing color and moving the cursor:
Code:
#include <stdio.h>
#include <windows.h>
#include <wincon.h>
void Gotoxy(int, int);
int main(void) {
int x, y;
char *starlight = "Oh Be a Fine Girl Kiss Me";
char *ilike = "I like blue stars";
for(x = 0, y = 1; x < 41;) {
Gotoxy(x,y);
printf("%s", ilike);
x += strlen(ilike)+1;
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE | BACKGROUND_RED | BACKGROUND_BLUE |BACKGROUND_GREEN);
printf("\n%s\n ", ilike);
for(y = 4, x = 10; y < 18; y+=5) {
Gotoxy(x, y);
printf("%s", starlight);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED | BACKGROUND_RED);
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|BACKGROUND_BLUE);
printf("\n\n\n%s", starlight);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE|BACKGROUND_BLUE);
printf("\n\n");
return 0;
}
void Gotoxy(int x, int y) {
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
/*
RED + GREEN + BLUE = White
RED + GREEN = Yellow
RED + BLUE = Magenta
GREEN + BLUE = sickly Green
*/
Printing from the bottom up is generally to be avoided, as WhiteFlag noted, above. If you want to start your drawing at the bottom of the page, you can always draw it starting at the bottom of the page, (use a series of newlines to get there), and printing it normally, let it continue to cause the screen to scroll up, as you continue printing your lines, in top to bottom order.