Friday, August 11, 2017

Let's learn Programing in C


Programming:

How to programming in c programming, how to write a program in a software or program what to write-side dice, these will be about. As we are automatic machines, all with one or more than one program. And the program is written in programming language. Programming of software only if computer is not everything that can be made for the program will be made. A little calculator started everything robots or aircraft program.
There are many Programming Language to learn. This is one of the most popular one is the C Programming. Dennis Ritchie (born September 9, 1941 – died October 8, 2011) developed this new lot of c language is created in the future. Learn how to make a language later many of the language can be written easily in code.
Computer processing of programming instruction. Instruction is to write some specific rules. That is, it is write programs that accept rules programming language. Learn a lot of things for us to learn to learn c++. We used software, Web site or mobile app, home automation can create software etc. And it can do today if we started learning. Veryeasy teach. What you need is a computer, Internet and nothing. Learn from the rest of the Internet. Need is a text editor for writing programs or ID.

A programming language is a few more topech operators, strings and carectar, control flow, looping, function, array, etc. A few topech are language based. If you know of a language are well known for the rest of the language easily. Here are useful all the top easy tried to write.

The first c program:

Need a computer for programming and compilers. Two of the like isn't it? Both begin with the letter k and "morop" is racist.
You have a computer then it could not read the article, isn't it? Nowwe need a compilers. A c compilers. Our code will not compile the code programming.
Why do I need previous compilers. We cannot read what we write computer it. Need for machine language of the computer. Our changes to the c programming language to machine the compilers. We compiled c code CodeBlocks IDE for writing and will use. If you go to the link below to download CodeBlocks codeblocks-12.11mingw-setup_user.exe 
Then install. Open the file. Then look like below to do so.

                                           If you install code ready for writing.
                                          Create New Project from here this .


And select Console Application from here click Go.

Now click Next and select C. Name your project Project Title box. For example, hello. Folder to create a folder for your project from the project in the Save in box to select whether you want. Next is kaila. NowFinish this kaila.
Now the right side you will see your workspace. There are your project. Click on the + sign hello. Then click on the + sign and main Source ... click on c. CodeBlocks is a simple project to make a code for templates, it will show. Including the text:
#include<stdio.h>
int main()
{
    printf("Hello world");
    return 0;
}
Our code is compiled and run from the file menu for her to click and Build and Build, click Run. Will compile and run your c program. And like the one below will output

If you can run the above program, congratulations and welcome to the world of programming. Not need to be depressed. Try a little bit from the beginning again. Then.
The above code we write now, let me explain a little.
The first line of our program is #include <stdio.h>. Include means nothing. Stdio's standard input is output grows. Stdio. h. h make it witha header file. And the entire line is used with standard input output log. Standard input output about a little bit later.
The next line is int main (), it is called a main function. When we shall run the program then will start working from the main function. So all a program (and only one) main function. In the beginning of the main function is to start with the second bracket. The main function is to complete a second bracket.
The main function of the second bracket inside the first line, we writeprintf ("Hello world!");
Here the printf () is a function. Printf it means print formatted. It is a library function which standard uput function. Printf () is working on the console/screen print. Double quotation marks inside what we write it will print on the screen. We first write a line that #include <stdio.h>. Printf () function is how some prints reads the stdio. h file.
After that, we write another line return 0; We say that a function is main. Each function has a return value. What function returns something at the end of its work. Return 0 means zero return. For more detailsabout this later when we read about the function.
printf("Hello world!"); Or return 0; These are called statement (Statement). At the end of each statement a semicolon (;) . If we do not deal with semicolons, will run the program and mistakes in compilers. Programming in the beginning many people forgot to semicolons, compile error (compile error), then try to find where it went wrong. A little noticed code entered these minor mistakes can easily be avoided.
Now, this program does not try to write yourself. Hello world! Like your name or will instead try to run with.

Problems and solving:
Code block is an IDE. It takes our compilers. We will compile the c programs. If you do not have installed compilers, like the one below iror.
Environment Error Can't fild compiler executable in your configurd search path for "GNU GCC" compiler

For this we need to install Mingw with Codeblocks downloads including. Codeblocks mingw download  page, setup exe is x-x.x. downloads in order ... This will solve the problem.

Tibe and variable data:
We have only one line in program before deta a output shown. Which is just enough to start programming. In fact we have to write complex programs. The idea of our need for variable.
Variable is a name that no data in the memory of the computer. Thisdata may be naumraharik (any number) or a character value. What types of data will be in this variable we are data type. Variable we learnagain later. Now I know about this data tyfe.
There are many types of data type in c programming. Among the main four:
int data type
char data type
float data type
double data type

int data type

Int data type to integer quantity (indivisible subscribers like 1, 2, 3 etc.). Its size 2 bytes or 16 bits (1বাইট = 8বিট) and reroz-32768 32767 to +. Some compilers for the int data 4 bytes of memory. In other words, a maximum of 4 bytes data type int data. Whose range is-2,147,483,648 to 2,147,483,647 this range means that the number of its biggest quality if we do use the compilers will not correct value. This size and ranges in different compilers.
Int data type's as an example, we can see a program. Length and breadth of the land, a azyetakar know we can find its area. Isn't it? I thinkthe length of 5 units and width 8 units. We have an area of 5 * 8 = 40units. How we can find it in the program? See the program below.
#include <stdio.h>

int main()
{
 int volume;
 int length = 5;
 int width = 8;
 volume = length * width;
 printf("%f", volume);
 return 0;
}
If you run the program, we'll see 40 output
It certainly looks from our first program complex. And a little big. Butof course much easier. A while ago we called bharzaribal listening to the object name keeps the store or save anything that is computer memory.
The area of land out to us is to keep in memory the computer. We need to keep in memory a computer variable. We have our variable name for an area of volume, but the volume we will know what kind of data it will not be the computer? We will, as a area and it is a number.
A while ago we learned about a data type name of int. What computer Integer/integer can be stored on the computer. So we've used int.And it's all one line of writing int volume; Called variable dochelareshon. In other words, a variable before using it to solicit. Dorcalesareshan last we have a cm Colón. At the end of a variable dorcalesareshan is to use a semicolon to the end. In other words, to solicit a variable like the one below:
data_type variable_name;
Tell us the computer that our length and breadth of the land, how, isn't it? For this we have two variable length and width. This two volume int again. A little bit different. We solicit these two variable with a value set. Called value assigned. To solicit variable including the quality process:
data_type variable_name = value;
After that, we write in the present volume = length * width; This means that the value for variable length and width variable value by multiplying this volume.
The next line with we. printf("%d", volume); What is the printf () function.
Printf () function's job is to print something. Printf () to print a text inside the double quotes entered in it, print it, we have to know before.
But this time we will print a variable value from insterge. We will have to follow some rules for this. Printf () to print a insterge inside the double quotes is% d, it is write with the placeholder. For each data type aladha aladha placeholders. % D means display integer. Double quotes after a comma. After writing our insterge variable. Which area of our land prints.
This thing that we could do in the face huh? It would be better if the program runs the length and breadth have been taken since. Then we could find any area of land. We are saikhab. More barjasik with the concept before.


Placeholders/Placeholder

A while ago we heard a word placeholder name. Each type has different placeholders for data. The following placeholders are a different type and their data are given
Data type
Placeholders
int
%d
char
%c
float
%f
double
%lf
character data type

Now we know a little bit about the character data type.
Char data type to single character (a race such as a, b, z, A, N, etc.). The size of 1 byte or 8 bits. Bit (1 byte = 8 bit) and reroz-128 to + 127.It is a sign of our keyboard each character. Carectar to solicit variable process:
char variable_name;
Character variable, only a carectar/letter/character can be stored. The following program dekhera
#include <stdio.h>

int main()
{
char ch = 'A';
printf("%c", ch);
return 0;
}
Here ch a carectar variable. Then we print it. To assign a variable of carectar for single quotation within. Thus "A".

float data type:

Integer data is stored in the integer-only taife. A integer variable by a decimal value e.g., 8.9 or some intention. After that the variable print. What he saw? There is no next part of decimal places? The following program runs into you see:
#include <stdio.h>

int main()
{
 int n = 8.9;
 printf("%f", n);
 return 0;
}
It's just our 8. Although we have within the variable 8.9. That's because the computer only to int is integer can be stored in the memory. The decimal value for the computer we need another data tyfe, called float.
Floating point number data type to float (floating-point subscribers like 10.5, 1.8, 5.6, etc). Floating point data accurate to the decimal value of 6 rooms after tyfe. The Data Type of the variable n the program changed to float into the run with:

#include <stdio.h>

int main()
{
float n = 8.9;
printf("%d", n);
return 0;
}
It is now the right value.
The area of a circle of radius of need for. Taking a circle radius 7.6 units. We wrote a program to find the area of felleh
#include <stdio.h>

int main()
{
float radius = 7.6;
float area = (radius*radius * 3.1416);
printf("%f", area);
return 0;
}
We took a point variable floting radius. The circle radius. Another variable in the name of the area in which the area took out.
We have the area of a circle is the RADIUS janar * baraisaradhian * PI value. So writing and we print the value.
In an example of the printf function integer before the placeholder we use as% d, floating point for this placeholder is% f. The rest is easy isn't it?
We knew that floating point decimal can give an accurate value for the room after 6. To get an accurate value until more homes than our need to use another data tyfe whose name is double.

double data type

Double precision floating point number data type to Double. This float data type is like size large. Its size 8 bytes or 64 bit. And it is accurate to the decimal value of 15 rooms.

We know that the circumference of the circle and the ratio of the diameter to PI/Pi [Π] with. It is an irrational number. It is not possible to express the decimal form is complete. There are infinite numbers after the decimal, for this. If we try to find value with the float, we get a decimal after the 6 rooms. But if we get double value, so an accurate value until 15 rooms after the decimal place. Double value as placeholders for output to print or to use lf. The following program is dekhera
#include <stdio.h>

int main()
{
double pi = 3.14159265358979323846;
printf("%lf", pi);
return 0;
}
Now, though, after the compile runtime after the decimal 6 homes. But we are saying to the accurate value of 15 rooms. Right said. Now you must tell how compilers decimal will print the last House. The following program is dekhera
#include <stdio.h>

int main()
{
double pi = 3.14159265358979323846;
printf("%.9lf", pi);
return 0;
}
Here we paslesholedare wrote. 9lf. How will print the decimal paslesholedare room only room in it will print. The above program now find value after the decimal will print up to 9 rooms.
Play naughty idea in mind?. 50lf in its place .. 9lf decimal will print after 50 rooms, right? Yeah, right ... just after the decimal if 50lf up to 50 homes will print. Want to get the results that we have it. Get wrong. The following program is dekhera
#include <stdio.h>

int main()
{
double pi = 3.14159265358979323846;
printf("%.20f", pi);
return 0;
}
Here we get to the decimal value of 20ঘর. We want to get the value up to 20 rooms. So paslesholedare have said that after the decimal 20f. 20 House print. But after 15 of the House's value until the maximum print. Then how many zero fill. Because after the decimal data type 15 room dobule standards just like you remember.

Data type and reroz

Read about suruteymra range, maybe just like I didn't realize. But this understanding is to leave. Int data type's size is what we said 2 bytes.We don't know a byte equals 8 bits. Then the two bytes equal to 16 bit. And this is the meaning of 16 bit (216-1) = (65536-1) = up to 65535 will be able to save correctly. I mean how we 0-65535 a inroterzare a value that can save. Now, if we as a value. Insterge data type, we save 65538 compilers will not be able to adequately value our output.

We are told that some compilers for inretarser 4 bytes memory allotment. 4 bytes means 4 * 8 bits. = 32 bit. And 32 bit means we (232-1)= (4294967296-1) = 4294967295 can save up to insterge data type value is correct. If a value larger than insterge want to save as, then get the output as well. Which will it wow. Wow why. Any number larger than 4294967295 before insterge prints as variable. For example, 6294967295
#include <stdio.h>

int main()
{
int n = 6294967295;
printf("%d", n);
return 0;
}
How can output? I have 1999999999 ... Which is it to be found. Because insterge detataipe as a value greater than his ability we have trying to save.
The next number of 4294967295 4294967296, print dekhera
#include <stdio.h>

int main()
{
int n = 4294967296;
printf("%d", n);
return 0;
}
Can output to zero. 0.
Get 1 saw print 4294967297.
#include <stdio.h>

int main()
{
int n = 4294967297;
printf("%d", n);
return 0;
}

Thus, if we print 4294967298,

0 comments:

Post a Comment