How to Create a Program in Mingw Developer Tool: Language and Instructions

In order to create a program that is fully operational one needs to understand the programming language that is necessary. In the next number, I will teach you what instructions to write inside the main function and give you an example of a program.

Now that you know to create a project you also need to know what to command that project to do in order to get your program functional.

First of all, the base instructions are required to be included, and these are:

“#include < iostream >”

for a basic program which doesn’t use special functions;

but you may also need to add

“#include < fstream> ” – when working with files;

“#include < string >” – when working with character rows;

“#include < math.h > ” – when working with mathematical functions;

You must also include:

using namespace std;

After this you must choose whether you open the main function, create a function or declare global variables.

First of all.. what is a variable? A variable is a memory space noted with a letter usually like “x” or “a” which is used during the program to comply different tasks.

A local variable is declared inside a function. If u declare the variable before any function and after “using namespace std;” that variable will be known during the entire function.

Now what is a function?

A function is a set of commands you create using a pre-established language in order to make the program do what you need it to.

There are two types of functions:

Simple functions, or a subprogram;

Main function, or the program itself;

The simple functions are to be written before the main function and after the implicit set of instructions:

“#include < iostream >

using namespace std;”

Now write your function here.

The functions can be split into categories based on the type of data they return:

If you must return information on your monitor the function must be “Void”, if you need to return a value in order to use that value in the main function it must be “int” for natural numbers or “float” for real numbers.

The main function in MinGW is always “int”.

Now to declare our main function use:

“int main ()”

afterwards start composing the body of the program which must be contained by

“{

}”

2
Liked it
3 Responses to “How to Create a Program in Mingw Developer Tool: Language and Instructions”
  1. Christyan S. Says...

    On February 14, 2012 at 10:54 am

    Good work ! You should also include a bonus , like ” Hello world” .


  2. Radu1103 Says...

    On February 14, 2012 at 11:42 am

    Thank You! I will Make a Complete set of lessons about how to use this the MinGW Tool in order to create programs.


  3. Radu1103 Says...

    On February 14, 2012 at 11:43 am

    Oops, I included a useless “this” in the previous comment, my mistake.


Post Comment