what library do i need to use a function like setxy(x,y) to align my text, or are there any other funcions to do that out there as well?
what library do i need to use a function like setxy(x,y) to align my text, or are there any other funcions to do that out there as well?
In order of learned:
HTML - Mastered
CSS - Enough to use
SSI - Mastered
PHP - Advanced
C/C++ - Current Project
This is implementation dependent, what compiler/OS do you use?
-Prelude
My best code is written with the delete key.
i use dev c++ 4.9.7 mingw 3.2 i beleive, and thanks for always helping prelude
In order of learned:
HTML - Mastered
CSS - Enough to use
SSI - Mastered
PHP - Advanced
C/C++ - Current Project
I believe Dev C++ supports the Win32 API. If so then this should work nicely.
-PreludeCode:#include <windows.h> void gotoxy (int x, int y ) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ), coord ); }
My best code is written with the delete key.
hm.. it says coord is undefined, any ideas or something i should have also done?
In order of learned:
HTML - Mastered
CSS - Enough to use
SSI - Mastered
PHP - Advanced
C/C++ - Current Project
>any ideas or something i should have also done?
If you pasted the code exactly as I posted then it should work. There is another thing you can try though, if I remember correctly, your compiler does implement gotoxy in conio.h or conio.c. Try including one of them and see if you can use it. be sure to remove the function I gave you though.
-Prelude
My best code is written with the delete key.
I tried the code, written by Prelude, and it worked fine using Dev C++ 4.
none...
can't u just use setw() from iomanip.h?
if you do setw(), then you have to do a number of things to center.
Code:#include <cstring.h> #include <iostream.h> #include <iomanip.h> main() { string name = "TITLE"; int length; length = strlen(name.c_str())/2; cout << setiosflags(ios::right); cout << setw(40-length) << name << endl; }