Commit b5e58d2d authored by Rohan Sakhale's avatar Rohan Sakhale

Added more post and minor adjustments

parent 42ffd86d
Pipeline #4557091 passed with stage
in 3 minutes and 16 seconds
---
title: Displaying message in various computer languages
date: 2011/03/24
categories:
- Codes
tags:
- code-example
- php
- java
- c/cpp
---
So by starting as a simple post toward my contribution for programming, lets see how messages can be displayed in different programming languages.
### Hello World in "C"
Using the `printf()` function from `stdio.h` library we write the following instructions for computer to print a message "Hello World
```c
#include<stdio.h> //including Header File
/**
* Main is the entry point for our program
*/
void main()
{
//whatever is displayed in double quotes is printed on the console
printf("Hello World");
}
```
### Hello World in "C++"
Using the `cout` object from `iostream.h` library we write the following instructions for computer to print a message "Hello World".
Here the `cout` object uses an operator called insertion ('<<') which is used to print everything within it on the console.
```cpp
#include<iostream.h> //including Header File
/**
* Main is the entry point for our program
*/
void main()
{
//whatever is displayed in double quotes is printed on the console.
cout << "Hello World";
}
```
### Hello World in Java
Class **System** comes with various console objects like `out`, `in`, `err` which can be used for various purpose. The System library comes from `java.lang` package which is default imported by Java everytime it runs.
The `out` object from **System** class helps to redirect output towards the `console`.
```java
import java.lang.*; // importing java lang library
class Main
{
public static void main(String [] args)
{
System.out.print("Hello World");
//To end the message with a new line we use println() method
System.out.println("This statement will add a new line at the end");
System.out.print("This will be printed on new line");
}
}
```
### Hello World in C#
The class System has various objects predefined in C# library, so we use System library & gain the class called "Console" which is attached to the console i.e. Screen & invoke static method called write() using that Console class-name.
Basic functionality is to print everything within quoutes.
```csharp
using System;
namespace FirstProgram
{
class Program
{
static void main(String [] args)
{
Console.Write("Hello World");
//to end the message with new line we use WriteLine() method
Console.WriteLine("This should add a new line at the end");
Console.Write("This message ends with new line");
}
}
}
```
### Hello World in PHP
**PHP** is a powerful language for web, in-order to print any message we just use `echo` keyword & whatever typed in double or single quotes is  displayed as message. Both single & double quotes has separate meaning & we will come across it some other day.
A php program is always enclosed with "`<?php STATMENTS HERE ?>`"
```php
<?php
echo 'Hello World';
?>
```
So we end up here now, I hope you have come to know how to display message in 5 different languages, I will come back with more languages very soon.
\ No newline at end of file
......@@ -4,9 +4,9 @@ date: 2014/01/21
categories:
- Collaboration
tags:
- Online Activity
- GIT
- Social Coding
- online-activity
- git
- social-coding
---
Get On D (The) Line, just a phrase from the movie "[Internship](http://www.theinternshipmovie.com/)" which I have seen quite ago reminds me of the app they wanted to build for the competition with a catchy phrase "Get On The Line" something like Instagram does but the exact moment we click it and gets on the line. I don't want to get into the movie talks, but what I want to bring your focus is Get Your Self On The Line now.
......
......@@ -4,7 +4,7 @@ date: 2011/06/27
categories:
- Codes
tags:
- c/c++
- c/cpp
- code-example
---
......
......@@ -4,8 +4,7 @@ date: 2015/06/20
categories:
- Personal Experience
tags:
- Personal Experience
- Amul Sirs Private
- personal-experience
---
For me going school was just a regular day with no path why we are doing this until I met Claira Miss, in sixth standard, where I learnt importance of education and started scoring good since sixth standard but the path was not clear yet. Why are we studying, it was regular mugging up and scoring goods.
......
......@@ -3,7 +3,7 @@ title: My First Blog Aware Static Website
categories:
- Personal Experience
tags:
- Static Site
- static-site-generator
---
I always wonder how several plugins host their pages on GitHub and never realized that actually those were GitHub pages, thanks to GitLab Pages and their blogs & obvisouly well documentation helped me understand quite easily what these blog-aware static websites are and also helped me get started with it quite easily.
\ No newline at end of file
......@@ -4,9 +4,9 @@ date: 2014/01/17
categories:
- Personal Experience
tags:
- Annual Festival
- Tech-Cult Fest
- Vartak Integrity
- annual-festival
- tech-cult-fest
- vartak-integrity
---
11th January 2014, [Vartak Integrity 2014](http://2014.vartakintegrity.com/) a tech-cult annual festival of [Vartak College](http://www.vartakcollege.co.nr/)[Vasai Road](https://maps.google.co.in/maps/place?ie=UTF-8&q=Vasai+Road&fb=1&gl=in) ended with a great success carrying out various cultural exciting events. **Dr. Satish A. Joshi Principal of Vartak College, Head of Information Technology Department Mrs. Sushma V. Brahmankar & Head of Computer Science Department Mrs. Srimathi Narayanan** inaugurated the 3 days event on 9th January 2014 with an exciting speech by Principal producing an enthusiasm in the youngsters to not only participate but also to enjoy the event to the fullest anticipating the legend within individual. The first day started with Rangoli the most fascinating event that collaborates beauty of colors and arts, many teams participated and created beautiful artistic rangoli's, I specially enjoy watching the beautiful art by participants.
......
---
title: Variables & their Usage
date: 2016-10-10 23:57:49
date: 2011/06/09
categories:
- Codes
- Learning
tags:
- learning
- code-example
- c/c++
---
A **variable** is a symbolic name given to some information or data. Generally a variable in programming are used to store location of data stored on memory and thus also access the contents on those memory address and they are always willing to change during the time of program execution, hence they are said to have varying values.
Unlike variables in Mathematics we used which were always named shortly for easy manipulation, the variables in programming are given specific or long name to make them relatively descriptive of their usage and also help to understand easily during the development of program.
Variables can be used frequently and they can also be re-assigned values as many times as we need (generally in iterations which we will talk later).
The names given to the variables are also said to be the identifiers, i.e. we identify a value or data using a descriptive name.
Rules on declaring an identifier:
> Should never be a keyword
> Should never start with number or special character
> Can be started with alphabets or underscores
> Letters with Upper case and Lower case mean different as ASCII values are different
> The length of an identifier depends on what programming language we use and what restrictions they put.
Actually these names that we use for variables are converted into memory location by the compiler for program execution, so the identifiers are only meant to be understood for programmers perspective, at bottom end everything is converted into machine language which computer understands.
Lets take an example in C language on declaring a variable using a data-type:
![Variables](/images/variable.png)
> So as the diagram says, `int` represents a datatype, `var1` represents the identifier what we say as variable name & all statements should end with a semicolon
Now talking more about datatype, each datatype has different memory allocation size in different languages.
Talking about C language, the datatypes and their sizes are as follows;
| DataType | Size in Bytes | Range |
|--------------- |--------------- |---------------------------------- |
| signed char | 1 | -128 -> +127 |
| unsigned char | 1 | 0 -> +255 |
| int | 2 | -32,768 -> +32,767 |
| unsigned int | 2 | 0 -> +65,535 |
| long int | 4 | -2,147,483,648 -> +2,147,483,647 |
| float | 4 | ±37E -> ±38E |
| double | 8 | ±37E -> ±307E |
| long double | 12 | ±37E -> ±4931E |
Some addition of datatypes were added in C++ as follows:
| Datatypes: | void | boolean | character | integer | floating-point |
|------------ |------ |--------- |----------- |--------- |---------------- |
And the list goes on for Java & C# and many other languages.
Lets see a variable in a diagrammatic cuboid,
![Variables Cube](/images/variable-cube.png)
So in this cube, there are three phases seen namely identifier, value/state/ and memory location which represents a complete variable. Always we should think of a variable in a cubic form.
Here var1 is the variable name, which has a value or state of "10" & stored on a memory location of "2000".
A short program on variable arithmetic operation,
```cpp
void main()
{
int a,b,c; // Declaration of Multiple variables in single line.
// Initialisation of a variable
a = 10;
b = 20;
// Arithmetic operation on a & b variable & assignment on variable c
c = a + b;
// Displaying states / values of variable
printf("A: %d , B: %d , C: %d\n",a,b,c);
// To hold program after execution we use the following function
getch();
}
```
Output of the above code:
```
A: 10 , B: 20 , C: 30
```
The above was the short description on variables & their usage and we can use them in multiple languages having the same architecture we seen above.
\ No newline at end of file
......@@ -4,9 +4,9 @@ date: 2014/01/05
categories:
- Personal Experience
tags:
- Annual Festival
- Tech-Cult Fest
- Vartak Integrity
- annual-festival
- tech-cult-fest
- vartak-integrity
---
<div>[![](http://4.bp.blogspot.com/-s_sHteGMcgU/UtgxLRgg_4I/AAAAAAAABno/Iknc5LFxQik/s1600/logo.png)](http://4.bp.blogspot.com/-s_sHteGMcgU/UtgxLRgg_4I/AAAAAAAABno/Iknc5LFxQik/s1600/logo.png)</div>
......
......@@ -4,8 +4,8 @@ date: 2011/08/25
categories:
- Inspirational
tags:
- Learning
- Motivational
- learning
- motivational
---
Have you heard of Roger Bannister? He was the first athlete to run the mile in less than four minutes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment