C

+2 Ray Haq · December 16, 2014

#include<stdio.h>
#include<conio.h>
 
main()
{
printf("Press any key to clear the screen.\n");
 
getch();
 
clrscr();
 
printf("This appears after clearing the screen.\n");
printf("Press any key to exit...\n");
 
getch();
return 0;
}


#include<stdio.h>
#include<conio.h>
 
main()
{
textcolor(RED);
cprintf("C programming");
 
getch();
return 0;
}

Why this codes "clrscr" and "textcolor" is not working??
i've found it in this website..
http://www.programmingsimplified.com/c/conio.h

Post a Reply

Replies

Oldest  Newest  Rating
+2 Daniel Collier · December 16, 2014
clrscr();  used to be a function in <conio.h>, in old Borland C compilers.

It's not a C++ standard function.

no you have to use system("clear");


as to the text colour, what are you trying to change the colour of? the console output ?
0 Ray Haq · December 17, 2014
i was just wondering how will the colors change!!! im new to this....... i dont know much about it!!
+2 Daniel Collier · December 17, 2014
#include <iostream>

int main()
{
while(true)
{
system("Color 1A");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color 2B");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color 3C");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color 4D");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color 5E");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color 6F");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color A1");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color B2");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color C3");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color D4");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color E5");
std::cout << "\t\t\t    Hello World" << std::endl;
system("Color F6");
std::cout << "\t\t\t    Hello World" << std::endl;
}
return 0;
}
  • 1

C

107,002 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator