Sample C Program In Dev C++

Posted on by
Sample C Program In Dev C++ Rating: 7,0/10 1453 votes

Aug 19, 2011 Run Graphics programs in Dev C. Many people uses Turbo c to run c and c programs. More people want to do graphics programs.If they use windows 7 64 bit they may not be able to run Turbo c. Dev C is more user friendly.Here you can see how to run graphics programs in Dev C. A valid C program must have the main function. The curly braces indicate the start and the end of the function. The execution of code beings from this function. Std::cout example, 'Hello World!' Is the format string.

Most common quiestion is:

Is there any C++ GUI API?

My answer is MANY.

There are many API's for making GUI applications.
Here are some.

1. WinAPI: (C based)(MFC is C++ based)
Its a great API and the best solution if you are windows programmer. First code will look a bit difficult, but later (after making few apps.) you will see its not so rusty. I like it, because you can do almost everything with it (in windows). The only bad thing is, that you cannot make applications for Linux with it.
Tutorial:
'>http://www.winprog.org/tutorial/index.html
2. Qt4 / Qt3 (C++ based)
This is a nice API, for making GUI applications. It works under Linux, Windows and Mac OS X. Its really easy to learn and use. But, until you dont buy licenced version, you will need to add tons of -dll s, to run your application. Qt compiler doesnt work in Vista. And, Qt4 API has a bit complicated way, to get buttons to work, if button holds some more complicated operations(actually you have to make your own SLOT's).
Tutorial:
http://sector.ynet.sk/qt4-tutorial/
http://doc.trolltech.com/4.2/examples.html
3.GTK+ (C based)
Sorry, but I never tryed it, so Google might help you.
Tutorial:
http://www.gtk.org/tutorial/


Some examples:

WinAPI
Simple message box:

Simple window:

Sample C Program In Dev C++


QT4
Simple Message Box:

Note: Use MsgBox for making message boxes


Simple Window:


GTK+

Simple window:

I hope this post will help anyone!


Dev C++ Program Examples

  • 3 Contributors
  • forum 3 Replies
  • 85,465 Views
  • 9 Years Discussion Span
  • commentLatest Postby sreenivasulaLatest Post

jan10241887

I also think newbies dont know for C++ IDE's. (Developing Enviroviment).

I will make a short description of some

1. Visual Studio 2005 (Visual C++)
This is a beautiful IDE for making console and win32 GUI applications. You can also compile DirectX10 or 9 projects as well. I didn't test it for compiling Qt or GTK+ applications yet.
Affcourse as a Microsoft product isn't free, but it seems to be really safe and stable IDE for Windows Applications.
I really like it, and I recommend it to everyone.

More info '>HERE

2. Code::Blocks
Great for compiling WinAPI, Qt, GTK+, WXWidgets, Ogre, D, C++ console, C console and other projects. I found some bugs, and sometimes there are problems to compile.
It's one of the best FREE IDE's.

Information and download '>HERE

Sample

3. Dev-C++
This IDE, written in Delphi is the right place for beginners. It isn't perfect and it allows you 'holes' and 'bugs' in your program.Thats why its good for beginners. VS2005 wouldnt compile most of the code, which Dev-C++ does.

Information and Download '>HERE

SOME LINUX IDE's:
-Code::Blocks
-Anjuta IDE
-QDevelop

Ah, and dont take care about all off my opinions. I prefer VS2005, but If you dont have a money, than choose Code::Blocks or Dev-C++.


I hope moderators will make this topic sticky (read me)

I hope this helps

BTW: Sorry for my grammatic mistakes.

C++ language is a direct descendant of C programming language with additional features such as type checking, object oriented programming, exception handling etc. You can call it a “better C”. It was developed by Bjarne Stroustrup.
C++ is a general purpose language language, when I say general purpose it simply means that it is designed to be used for developing applications in a wide variety of domains.

C++ Tutorial

To learn C++ programming, refer these tutorials in the given order. These tutorials are written for beginners so even if you have no prior knowledge in C++, you won’t face any difficulty understanding these tutorials.

Basics

1. First C++ Program – Hello World!
2. Variables and their types
3. Data types
4. Operators in C++

Control Statements

5. If, if.else-if statement
6. Switch Case in C++
7. For loop
8. while loop
9. do while loop
10. Continue statement
11. Break statement
12. goto statement

Functions

13. Functions in C++
14. Default arguments in Functions
15. C++ Recursion

Arrays

16. Arrays
17. Multidimensional arrays
18. Passing Array to function
19. C++ Strings

Pointers

20. Pointers in C++
21. this Pointer

OOPs

Sample C Program In Dev C Template

22. OOPs Concepts
23. Constructor
24. Destructor
25. Structure
26. How to pass and return struct from function
27. Enumeration
28. Inheritance
29. Polymorphism
30. Function Overloading
31. Function Overriding
32. Virtual Function: Run time Polymorphism
33. Encapsulation
34. Abstraction
35. Interfaces – Abstract class
36. Pass and return object from function
37. Friend class and friend Function

Features of C++

Dev C++ Program Download

1) Better memory management – you can dynamically allocate memory during runtime using new and delete operator in C++ to have better memory management.

2) Object oriented – C++ supports object oriented programming features, which means we can use the popular OOPs concepts such as Abstraction, Inheritance, Encapsulation and Inheritance in C++ programs, these features make writing code in C++ a lot easier. We will cover them in detail in this tutorial series. Auto tune mobile ios free.

Simple C Program In Dev C++

3) Portable – Most of C++ compilers supports ANSI standards that makes C++ portable because the code you write on one operating system can be run on other Operating system without making any change. We cannot say C++ a fully platform independent language as certain things in C++ are not portable, such as drawing graphics on a screen, since standard C++ has no graphics or GUI API.

4) Structured programming language – We have functions in C++, which makes easier to break a problem into small blocks of code and structure the program in such a way so that it improves readability and reusability.

5) Exception handling: Just like Java we can do exception handling in C++ which makes it easier to identify and handle the exceptions.

Sample C Program In Dev C 5

6) Simple – Last but not least, just like C, it is easier to write a program in C++. Once you get familiar with the syntax of C++ programming language, it becomes a lot easier to code in C++.