| View previous topic :: View next topic |
| Author |
Message |
haha01haha01 Grandmaster Cheater Supreme
Reputation: 0
Joined: 15 Jun 2007 Posts: 1233 Location: http://www.SaviourFagFails.com/
|
Posted: Sat Jul 21, 2007 3:36 am Post subject: question about C |
|
|
im programming some stuff in C, using "microsoft visual studio 6.0 ->microsoft visual c++ 6.0
it work great but there is 1 prob.
i know that to make the clrscr() command i need to include <conio.h> and to make randomize() i need to include <stdlib.h> but even if i include these files, still i cant execute the program beacuse of "unresolved external symbol_randomize" or "unidentified command_clrscr"
some alredy got that error b4 and know how to solve it?
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Jul 21, 2007 3:57 am Post subject: |
|
|
To be honest, i've never ever seen randomize(). I know srand & rand exist so try them.
As for clrscr, try this code which the_undead sent me:
| Code: | void ClearScreen()
{
HANDLE hSTD = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordinates = {0,0};
CONSOLE_SCREEN_BUFFER_INFO buffer_info;
GetConsoleScreenBufferInfo(hSTD, &buffer_info);
FillConsoleOutputCharacter(hSTD, ' ', buffer_info.dwSize.X * buffer_info.dwSize.Y, coordinates, NULL);
SetConsoleCursorPosition(hSTD, coordinates);
} |
|
|
| Back to top |
|
 |
haha01haha01 Grandmaster Cheater Supreme
Reputation: 0
Joined: 15 Jun 2007 Posts: 1233 Location: http://www.SaviourFagFails.com/
|
Posted: Sat Jul 21, 2007 4:18 am Post subject: |
|
|
where should i paste that clearscreen thing? if i put it inside my code it isnt working (making many errors)
as for the rand thing it worked but it always give the same value (not randomized).
maybe something in my files are wrong?
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Jul 21, 2007 4:31 am Post subject: |
|
|
to use the rand try this:
| Code: |
int rndNumber;
srand(); // This starts the rand stream btw!!!
rndNumber = rand(time(0)); |
I think it returns the number .
Heres some documentation: http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html
And the clear screen thing, just paste it under your includes and call it when you need to clear the screen:
|
|
| Back to top |
|
 |
haha01haha01 Grandmaster Cheater Supreme
Reputation: 0
Joined: 15 Jun 2007 Posts: 1233 Location: http://www.SaviourFagFails.com/
|
Posted: Sat Jul 21, 2007 4:40 am Post subject: |
|
|
| nope nothing works.
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Jul 21, 2007 7:34 am Post subject: |
|
|
get a new compiler. That's it. Go in the library of compilers post and pick one for C/C++
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
|