0

Help me please ... Why i cant execute this program?

#include <iostream> using namespace std; int main() { int a,b; cin>>a; gotoxy(1,1); textcolor(GREEN); cputs(a); return 0; }

1st Apr 2017, 5:10 AM
Hashis Bin Azeez
Hashis Bin Azeez - avatar
2 Answers
+ 3
gotoxy() is not defined in iostream, so, you have to define it first then it may work, COORD coordinate = {0,0}; //initialization void gotoxy(int x, int y){ //function definition coordinate.X = x; coordinate.Y = y; SetConsoleCursorPostion(GetStdHandle(STD_OUTPUT_HANDLE),coordinate); } void gotoxy(int x,int y) { printf("%c[%d;%df",0x1B,y,x); } /* here I gave 2 definition, you can use any one of them */
1st Apr 2017, 7:25 AM
Nikhil Dhama
Nikhil Dhama - avatar
+ 3
textcolor also not defined, these all functions are defined in conio.h, which is inbuild only in turboc++ or Borland c++, but in others you have to define all these functions because there is no conio.h there. instead of textcolor () , use system (" color 'background''foreground' "); example:- system("color A1");
1st Apr 2017, 7:31 AM
Nikhil Dhama
Nikhil Dhama - avatar