#include <iostream>
#include <stdlib.h>
#include <time.h>
main(void)
{
srand (time (NULL));
unsigned short RNumber = rand () % 100;
unsigned short GNumber = 0;
bool WorL = 0;
std::cout << "Pick a number 1-100";
std::cin >> GNumber;
while (WorL != 1)
{
if (GNumber > RNumber)
{
std::cout << "Go lower" << std::endl;
std::cin >> GNumber;
}
if (GNumber < RNumber)
{
std::cout << "Go higher" << std::endl;
std::cin >> GNumber;
}
if (GNumber == RNumber)
{
WorL = 1;
}
}
std::cout << "Congratulations!!" << std::endl;
return 0;
}
The error message is this:
Loaded ''ntdll.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM32\kernel32.dll'', no matching symbolic information found.
The thread 0x510 has exited with code 0 (0x0).
The program ''C:\Game Studio\Visual C++\MSDev98\MyProjects\Chapter 3\Work\Debug\Work.exe'' has exited with code 0 (0x0).
I can''t seem to figure out whats wrong...
- Thanks in advance -
- Chris
Why is this happening?
Writing a tutorial for newbs, I was writing a simple ''guess the number game.'' I found that I had my own mistake in writing it and I can''t figure out what is wrong with it.
- Am I the newbie here? -
tcacheContact Me-----------AH! MY BRAIN IS GOING TO SELF-DETONATE! -- Yours Truly (Jan, 2003)
Uhh... there''s no error. Your "error" message indicates a total success.
OT, but I feel that it''s necessary to note that you are coding in both C and C++. Pick one or the other, not both.
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
Isn''t that your std::cin better be included into the while loop as well? ... think about it.
Happy learning.
Happy learning.
"after many years of singularity, i'm still searching on the event horizon"
I fail to see any help in InvaderX''s constructive criticm. It would be much more helpful if he explained where to make changes to suit "his" ideal programming style. If it works the way you intended it to work then you''ve done a good job.
Regardless, I always admire those willing to share what they know to anyone who is willing to learn. Good Job.
I compiled your code and everything ran the way it should. A few logic bugs but you''ll quickly be able to fix them.
Good Luck with your tutorials, and I hope they become more advanced over time.
Chris Z.
ZeroFX Interactive
Regardless, I always admire those willing to share what they know to anyone who is willing to learn. Good Job.
I compiled your code and everything ran the way it should. A few logic bugs but you''ll quickly be able to fix them.
Good Luck with your tutorials, and I hope they become more advanced over time.
Chris Z.
ZeroFX Interactive
Chris Z. GPU FX
quote: Original post by ZeroEffect
I fail to see any help in InvaderX''s constructive criticm. It would be much more helpful if he explained where to make changes to suit "his" ideal programming style.
use <cstdlib> instead of <stdlib.h>
use <ctime> instead of <time.h>
quote:
If it works the way you intended it to work then you''ve done a good job.
Maintainability. Disregarded by amateurs. Essential for professionals.
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
quote: Maintainability. Disregarded by amateurs. Essential for professionals.
def'n - newb, n. See beginner. Also see "New to programming" or Amateur.
Unfortunately, too many beginners get caught up in the "proper" style of coding (C vs. C++, etc) and they never get a chance to explore and learn. By learning the foundations and theory behind programming it becomes very easy to switch between:
cstdlib and stdlib.h
ctime and time.h
And, with a strong foundation it becomes easy to switch between different languages as well. To all beginners out there don't get hung up on which libraries to use and whether or not to use pure C++ or to mix the it with C-style functions, this takes all the fun out of programming as a hobby. And, if and when you actually get a job as a programmer, the company will set the style and programming conventions. Many times you'll will have no say in this and your greatest asset will be your ability to adapt.
Sorry for the rant.
Chris Z.
ZeroFX Interactive
[edited by - ZeroEffect on October 7, 2002 1:32:43 AM]
Chris Z. GPU FX
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement