Saturday, 21 November 2015

create a canvas in:HTML5

create a canvas in:HTML5
create a canvas in:HTML5
canvas on the "HTML5" is used to draw on a web page. the canvas, we can include 2D or 3D objects into a web page. In the "HTML 5" canvas can not work alone so it takes the name of Javascript to create objects in it either 3D or 2D.

<!DOCTYPE html>
<html>
<body>
<canvas id="canvas" width="200" height="100" style="border:1px solid #000000;">your browser not support html 5</canvas>
</body>
</html>
<html>



 <canvas id="canvas" width="200" height="100" style="border:1px solid #000000;"></canvas> 
program "canvas" allows you to create a place to draw something.

RESULT
create a canvas in:HTML5


If you want to add "background color", you just replace the code "# 000000" with other colors.like the example below.

<!DOCTYPE html>
<html>
<body>
<canvas id="canvas" width="200" height="100" style="background: azure;border:1px solid #000000;">your browser not support html 5</canvas>
</body>
</html>
<html>

RESULT
create a canvas in:HTML5


a first step coding HTML5:HTML 5

a first step coding HTML5:HTML 5
a first step coding HTML5:HTML 5
in the first post "html" I will give a lesson on basic tag on htm 5.

<!doctype html>
<html>
<head>
<title>.::Title::.</title>
</head>
<body>
 section contents
 </body>
 </html>


 <html> </html>
to define a new "html" content.

 <head>
<title>.::Title::.</title>
</head>
to make the "title" in "html".

 <body>
 section contents
 </body> 
beginning-making "body" in "html".

RESULT
a first step coding HTML5:HTML 5

Friday, 20 November 2015

examples of plural selection switch statement:C Language

examples of plural selection switch statement:C Language
examples of plural selection switch statement:C Language
in today's post we will try statements plural switches that can count the number of letters that have been determined by the program.

#include <stdio.h>
#include <stdlib.h>

int main(){
    int value;
    int countA = 0; int countD = 0;
    int countB = 0; int countE = 0;
    int countC = 0; int countF = 0;
printf("the input value of the letters.\n");
printf("EOF character to end input,\n");
    while((value = getchar())!= EOF){
        switch(value){
    case'A':
    case'a':
    ++countA;
    break;

    case'B':
    case'b':
    ++countB;
    break;

    case'C':
    case'c':
    ++countC;
    break;

    case'D':
    case'd':
    ++countD;
    break;

    case'E':
    case'e':
    ++countE;
    break;

    case'F':
    case'f':
    ++countF;
    break;

    case'\n':
    case'\t':
    case' ':
    break;


    default:
        printf("the value entered incorrect\n");
        printf("input value of new letters.\n");
        break;
        }
    }
    printf("Total each letter :\n");
printf("A: %d\n",countA);
printf("B: %d\n",countB);
printf("C: %d\n",countC);
printf("D: %d\n",countD);
printf("E: %d\n",countE);
printf("F: %d\n",countF);
return 0;
}



 while((value = getchar())!= EOF){   
function "getchar" is derived from "<stdio.h>" that is useful to read characters from the keyboard and store it in the variable "int value".
EOF (end of file) is used to end like a "return 0;" with key "ctrl + z"


 switch(value){
    case'A':
    case'a':
    ++countA;
    break;
is used to determine which values to be entered. the program will run from top to bottom starting from "case 'A' case 'a'" to program "default :" under before closing curly brackets.

examples of plural selection switch statement:C Language

Monday, 16 November 2015

example problems statement for:C Language

example problems statement for:C Language
example problems statement for:C Language
someone invested $ 100 in a deposit account with an interest rate of 5%. It is assumed that all the flowers are combined with investment capital in the account, calculate and show the amount of money in the account at the end of each year for 10 years.

use the formula:
a = p (1 + r)²
P = the initial amount of capital invested
R = annual interest rate
n = number of years
a = the amount of money in the deposit at the end of year n

#include <stdio.h>
#include <math.h>

int main(void){
double a;
double P = 100;
double r = .05;
int year;
printf("%4s%21s\n","Year","Deposit");
for( year = 1 ;year <= 10; year++){
    a = P * pow(1.0 + r, year);
    printf("%4d%21.2f\n",year,a);
}
return 0;
}



double a;
double P = 100;
double r = .05;
"double" here has the same type with the "float". but the memory allocation "double" has a larger memory allocation from the "float".

 printf("%4s%21s\n","Year","Deposit");
 
"% 4s and %21s" is used to issue a letter that has been called by printf "4s" means to display the "string" with a wide field of "4" to explain that the value to be displayed is at position "4" in the execution of the program.

 a = P * pow(1.0 + r, year); 
Pow (1.0 + r, year) This program is used to raise to "1.0 + r" with the number of years.
EXAMPLE
#include <stdio.h>
#include <math.h>

int main(void){
int a = 2;
int b = 3;
int raise;
raise = pow(a,b);
printf("%d",raise);
return 0;
}
 

Sunday, 15 November 2015

sample program "FOR":C Language

sample program for:C Language
sample program for:C Language

on the discussion today I will give an example of a simple program using a command (for).

The first example
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int x;
    for(x=1;x<=10;x++){
        printf("%d\n",x);
    }
    return 0;
the role of the code above is to command increments that start variable "x = 1" and the variable is less than or equal to 10 and a code "x ++" is used to add "1 + x" in which the value of  "x is 1" and continue until the result is less than or equal to 10


for(x=1;x<=10;x++){
        printf("%d\n",x);
X=1 : Used to make the base in the statement (for).
X<=10 : Informing that the final value of the variable-value <= 10
X++ : Perform increment on control variable
printf("%d\n",x) ; displaying the results of the statement for (printf should be inside the curly braces for statement. if not then the result will be different)

the second example
the second program we will try to show the numbers from "1" to "10" but only even numbers are out.
#include <stdio.h>
#include <stdlib.h>

int main(void){
    long int x;
    for(x=1;x<=10;x++){
            x = x + 1;
        printf("%d\n",x);
    }
    return 0;
}


x = x + 1;
For example if out "X = 1" it will be "X = X + 1". So when read "1 = 1 + 1" program becomes "1 = 2" and "2" will be out in the program. and then number "2" will be missed because it had been executed by the program. so directly proceed to number "3 = 3 + 1" and so on until "10".

The third example
made the statement program (for) to bring up an odd number
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int x;
    for(x=0;x<=9;x++){
        x=x+1;
        printf("%d\n",x);
    }
    return 0;
}
The fourth example
displaying programs from "100" down to number "1"
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int x;
    for(x=100;x>=1;x--){
        printf("%d\n",x);
    }
    return 0;
}

The fifth example
changing the control variables from "x = 7 to x <= 77" by adding "7" at each increment. example  "x = 7 and x + = 7" the same as "x = x + 7 so 7 = 7 + 7", which means that "7 = 14".
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int x;
    int y;
    for(x=7;x<=77;x+=7){
        printf("%d\n",x);
    }
    return 0;
}
The sixth example
making the results into a coherent
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int x;
    for(x = 44; x >= 0;x-=11){
        printf("%d\n",x);
    }
    return 0;
}



Saturday, 14 November 2015

introducing visual basic programming

What Is Visual Basic
What Is Visual Basic
Visual Basic is one programming language developed by Microsoft since 1991 evolved form the earlier DOS version called Basic.This is one of the easy programming language because their code is much similar to the English language.visual basic advantages of other programming languages is located on the menu that you can directly drag and drop without the need to program in advance.
Below is an menu in visual basic

IDE(Integrated Developmen Environment) in Visual Basic:

Menu IDE Visual Basic

  • Menu Bar,used to select specific tasks such as save the project, open the project, etc.
  • Main Toolbar, used to perform certain tasks quickly.
  • Jendela Project,This window contains an overview of all the modules contained in your application. You can use the Toggle Folders icon to display the modules in the window in a sequence based on the name and you can use Ctrl + R to display the Project window, or use the Project Explorer icon.
  • Windows Form Designer,This window is used to design the user interface of the application that you created. so that windows is like a canvas for a painter. 
  • Windows Toolbox,This window contains the components that you can use to develop the user interface.
  • Windows Code,a place for you to write coding. You can display this window by using the key combination Shift-F7. 
  • Windows Properties,the list of properties that are selected object. For example, you can change text color (foreground) and the background color (background). You can use F4 to display the properties window.
  • Windows Color Palette,is the quick menu to change the color of an object. 
  • Windows Form Layout,will show how to form during runtime.
so many posts from me for just about visual basic introduction. and in the next post I will discuss more about the tools used in visual basic

Friday, 13 November 2015

Add Two Integer:C Language

Add Two Integer:C Language
Add Two Integer:C Language

add two integer in c language is one of the simplest program in this language.The discussion today we will try to make this program and ok let's see.

#include <stdio.h>
int main()
{
int integer1; /*first variable to input number*/
int integer2; /*second variable to input number*/
int sum; /*a variable to keep the sum*/
    printf("add first number = ");scanf("%d",&integer1);
    printf("add second number = ");scanf("%d",&integer2);
    sum = integer1 + integer2;
    printf("the sum is = %d",sum);
    return 0;
}

EXPLANATION

#include <stdio.h> 
stdio.h Is a preprocessor directive.Lines beginning with # and processed by the preprocessor before compilation.
int main(void)
int main part of the c language in a program building block called functions,one of which should be main function.
int integer1;
int integer2;
int integer3;
the name of the integer 1,integer 2, integer 3 is the name of a variable. a variable is a location in memory where a value is stored for use by a program.And int form C language is one of the data type in C language.

printf("add first number = ");scanf("%d",&integer1);
The above program is used to display the input literal numbers(add first number) on the screen and position the cursor at the beginning of the next line.And use scanf for enter data points from the keyboard.


sum = integer1 + integer2;
printf("the sum is = ",sum);
return 0;
sum = integer1 + integer2 used to add input that had been inserted.
printf below the sum is used to print the results from the sum of the two variables that have been in the declaration.
return 0; indicates the program stops perfectly.

ok guys how? easy and very simple is not it? in the next post we will get to know about the function of the c language. ok up here first and gratitude.
the result of the summation
the result of the summation