Getting Started

This image is an example of an engineering schematic.

The first and foremost thing to do when writing code is to logically think through the problem. You should create some sort of outline using either pseudo code (small snip bits of code to organize your thoughts) or an schematic showing all variables and loops required (or so you think). Example in the image above

How do you open a project?

When using codeblocks, press create a new project, console application, then open a new file. I usually save this using the name main.cpp because it is the top level design file unless you force it to something else.

Introduction

Now that you have a new project and know what will be required to complete the project, so now you can start inserting libraries and initializing variables.

Libraries are required to use function that are contained within them. These functions will need to be used to do anything. Please refer to the libraries section for additional information regarding libraries and the functions contained within them. If the error code file directory not found is present you can assume that you are having an error with your libraries. For the first programs you write you will be using the libraries stdio.h and stdlib.h and using operands such as scanf, printf, int, char, else, if, else, if, etc.

Variables are another important component to writing code. You must know what kind of data that you want to filter and how it is processed within the console. You can universally declare variables or contain them within functions. If you want the variable to be in all of the code simply insert it above the function declaration and below the libraries as so. Additional information is found in the section variables.

#include <stdio.h>

#include <stdlib.h>

int this_is_a_number; // a double slash means that this is a comment

//this is a variable initialization

char words; //you can also set these equal to values

float decimal_number; //you can't start with a number or have spaces 
                     //in the names

int main(){          //function decleration

this is the function

return 0;}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s