C Get Started. To start using C, you need two things: A text editor, like Notepad, to write C code; A compiler, like GCC, to translate the C code into a language that the computer will understand; There are many text editors and compilers to choose from. In this tutorial, we will use an IDE (see below). Install Dev-C. I installed from the Version 4.9.9.2 Setup File. Download graphics.h to the include/ subdirectory of the Dev-C directories. Download libbgia. To the lib/ In order to use the WinBGIm subdirectory of the Dev-C directories. Configuration: At last you’ve downloaded & installed the WinBGIm,now you have to configure it to use. Similarly, if you can get by with a few using-declarations (instead of using-directives) for specfic types in the std namespace, then there's no reason you shouldn't have just those spefcific names brought into the current namespace. By the same token, I think it would be crazy and a bookkeeping hassle to have 25 or 30 using-declarations when a.
Micheal main modified BGI library for windows application to be used under MinGW.This BGI library is renamed as WinBGIm.Now you can use all the borland specific functions under Dev-C++.
Installation :
- Install Dev-C++. I installed from the Version 4.9.9.2 Setup File.
- Download graphics.h to the include/ subdirectory of the Dev-C++ directories.
- Download libbgia. to the lib/ In order to use the WinBGIm subdirectory of the Dev-C++ directories.
Configuration :
At last you’ve downloaded & installed the WinBGIm,now you have to configure it to use under Dev-C++.You’ve to set some project options in Dev-C++ in order to run WinBGIm references properly.
Follow the steps below to set proper project options for WinBGIm.
Dev C Using Namespace Std Renew Jungle Guide
1. Go to the “File” menu and select “New”, “Project”,Choose “Empty Project” and make sure “C++ project” is selected.Give your project suitable name and click on “Ok”.
2. Go to “Project” menu and choose “Project Options”.
3. Go to the “Parameters” tab.
4. In the “Linker” field, enter the following text:
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32
5.Click “Ok” to save settings.
Now you’ve done with the configuration for WinBGIm.Please make sure you’ve donw this step properly otherwise compiler will flag error.
Testing & Debugging :
Now let’s write a small program to test how WinBGIm works.Here is the source code for the program.Type it down,save it with .cpp extension and compile and run to see the results.
#include <graphics.h>
#include <iostream>
using namespace std;
int main()
{
initwindow(800,600);
circle(200,300,600);
while(!kbhit());
closegraph();
return 0;
}
OUTPUT :
- C++ Basics
- C++ Object Oriented
- C++ Advanced
- C++ Useful Resources
- Selected Reading
Consider a situation, when we have two persons with the same name, Zara, in the same class. Whenever we need to differentiate them definitely we would have to use some additional information along with their name, like either the area, if they live in different area or their mother’s or father’s name, etc.
Same situation can arise in your C++ applications. For example, you might be writing some code that has a function called xyz() and there is another library available which is also having same function xyz(). Now the compiler has no way of knowing which version of xyz() function you are referring to within your code.
Dev C Using Namespace Std Renew Jungle Notes
A namespace is designed to overcome this difficulty and is used as additional information to differentiate similar functions, classes, variables etc. with the same name available in different libraries. Using namespace, you can define the context in which names are defined. In essence, a namespace defines a scope.
Defining a Namespace
A namespace definition begins with the keyword namespace followed by the namespace name as follows −
To call the namespace-enabled version of either function or variable, prepend (::) the namespace name as follows −
Let us see how namespace scope the entities including variable and functions −
If we compile and run above code, this would produce the following result − Vijay tv tamil serial list.
The using directive
You can also avoid prepending of namespaces with the using namespace directive. This directive tells the compiler that the subsequent code is making use of names in the specified namespace. The namespace is thus implied for the following code −
If we compile and run above code, this would produce the following result −
The ‘using’ directive can also be used to refer to a particular item within a namespace. For example, if the only part of the std namespace that you intend to use is cout, you can refer to it as follows −
Subsequent code can refer to cout without prepending the namespace, but other items in the std namespace will still need to be explicit as follows −
If we compile and run above code, this would produce the following result −
Names introduced in a using directive obey normal scope rules. The name is visible from the point of the using directive to the end of the scope in which the directive is found. Entities with the same name defined in an outer scope are hidden.
Discontiguous Namespaces
A namespace can be defined in several parts and so a namespace is made up of the sum of its separately defined parts. The separate parts of a namespace can be spread over multiple files.
So, if one part of the namespace requires a name defined in another file, that name must still be declared. Writing a following namespace definition either defines a new namespace or adds new elements to an existing one −
Nested Namespaces
Namespaces can be nested where you can define one namespace inside another name space as follows −
You can access members of nested namespace by using resolution operators as follows −
In the above statements if you are using namespace_name1, then it will make elements of namespace_name2 available in the scope as follows −
If we compile and run above code, this would produce the following result −