It's kind of hard to read your post, but I don't blame you...
graphics.h is a header file that is only for Turbo C, so don't bother trying to use it. ;)
Are you trying to write console or Windows graphics? For console graphics, you can't use libraries such as DirectX or OpenGL. Usually the easiest method to use on Windows is to use the Win API to do your console graphics. I suggest you start here: http://www.daniweb.com/code/snippet173.html
For going further, use Google; there's tons of information out there.
If you're trying to do Windows graphics, I recommend not using the Windows HDI and instead use an external library such as SDL, OpenGL, DirectX, etc. Also, I suggest you check out this thread on game development:
http://www.daniweb.com/techtalkforums/thread63827.html
Hope this helps
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
Hmm,first sorry for some grammar mistakes...
We can help you out with that a little. To make your posts more understandable, English uses spaces after commas (,) and periods (.). For example, note the space after that comma. And also note the space after that period. This will help. The rest we can figure out.
As for graphics, asJoe said you have to find a graphics package that you can add to your compiler. This and this Google search may give you something to work with.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
>>Our translations are sad,and it is not rare that code is wrong in books.
It is not your translator -- our books have those mistakes too.
>>most of the good books are not for free
One reason people write books is to make money, and they can not do that if they give their work away for free.
>>My knowlege is enough for undrestanding it and read it.
you do that very well, better than many native english-speaking people.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Hello there my friend. I really respect your enthusiasm but you must go a bit slow. Talking about DirectX, graphics and all that when you are just learning C / C++ is too much.
Please learn to crawl before you start running. Get your concepts about the things which are not directly related to a particular language (eg. data structures, algorithms ) a bit cleared up.
As far as books are concerned, I know they are expensive. But if you really have in your heart then nothing can stop you.
For C related free stuff you can see here.
For a really good C++ ebook you can see here and also a good site for C++ tutorials .
Hope it helped, bye.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
U CAN TRY AT
WWW.flazx.com
I THICK THIS WILL HELP U
Oh wow, that just blew me away... especially the fact that there's not a single bit of useful information there that you don't have to pay for. You might have just as well given as a link to Amazon. Or Google.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
Sure it's C++ code, but you could still use printf() for console output, as long as you don't mix the C and C++ I/O functions.
Just out of interest, does this code compile for you?
// color your text in Windows console mode
// colors are 0=black 1=blue 2=green and so on to 15=white
// colorattribute = foreground + background * 16
// to get red text on yellow use 4 + 14*16 = 228
// light red on yellow would be 12 + 14*16 = 236
// a Dev-C++ tested console application by vegaseat 07nov2004
#include <iostream>
#include <windows.h> // WinApi header
using namespace std; // std::cout, std::cin
int main()
{
HANDLE hConsole;
int k;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// you can loop k higher to see more color choices
for(k = 1; k < 255; k++)
{
// pick the colorattribute k you want
SetConsoleTextAttribute(hConsole, k);
cout << k << " I want to be nice today!" << endl;
}
cin.get(); // wait
return 0;
}
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
What exactly is the error you are getting ? The code seems to be perfectly alright and working so I guess the problem must be the way you have configured you IDE or with the project settings.
Post the kind of settings you used while creating the project along with the detailed error messages.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
Make sure that the file you created has a .cpp extension to it, or else the compiler won't recognize the code as C++.
And do what ~s.o.s~ said.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
Your code is working in my case, but some of the problems which you say are appearing as warnings are :
1) scanf("%s",&rec);
The scanf function requires the address of the variable as its second parameter. Since the name of the array is a pointer to its first element or holds the address of the array, you need only to supplyrec. Remove the & sign which you have placed in front of it.
2) scanf("%s",&izbor);
The same problem exists here.
3) Don't use system("pause") for pausing the program. Better use getchar() which is more poratble and more meaningful in this context.
4. Why the three functions which do exactly the same thing i.e. comparing two strings or I would rather say why a separate function for string comparision when strcmp() does the job well ?
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
That with system pause i don't understand.
Think of it this way: system() calls a command. In this case, you're calling the pause command.
How many platforms will support this? Exactly the same amount as the operating systems that have a "PAUSE" command in their path. Which means it's basically 1, which is Windows.
It's also very slow, because you have to tell the operating system to run another program just to pause yours - not good.
getchar() is fast because it doesn't use call another program, and it's portable - guaranteed to work on all platforms. So there's no need to use system("PAUSE").
But yeah, your code should work.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339