Basic programming Concepts:

Hi friends!!
Now we will get in to the programming!!
Till now every thing was about the Dotnet Framework,now its right time to get in to the C# Programming basics.
Before getting in to the basics like datatypes,functions etc.,first we will try to give a glance on the structure
of a C# program and is compared with the C++ program for better understanding and i guess it is an easy way!!
Both the languages are object oriented programming languages.

Structure of a C++ Program:-
// classes example
#include <iostream>
class add
{
int x, y;
public:
void set_values (int,int);
int sum ()
{
return (x+y);
}
};

void add::set_values (int a, int b)
{
x = a;
y = b;
}

int main () {
add addition; //creating object for class crectangle
addition.set_values (3,4); //calling class method set_values,passing parameter
cout << "sum: " << additon.sum();
return(0);
}

Structure of a C# Program:-
//1. namespaces
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//2. class definition
    class addition
    {
        static void Main(string[] args)//a main() with in the class.Program execution will start from main
        {
                  
            Console.WriteLine("Enetr First number");
//We can display any data from "Console.WriteLine()" Function.
            int val1 = Convert.ToInt32(Console.ReadLine());
//taking first value from the user from the "Console.ReadLine() "function and converting in to integer because the value that we have taken from the user will be in the form of string.
            Console.WriteLine("Enetr second number");
            int val2 = Convert.ToInt32(Console.ReadLine());
//taking second value from the user and converting in to integer because the value that we have taken from the user will be in the form of string.
            Console.WriteLine(addIntegers(val1, val2));
//here "addIntegers(val1,val2)" is a function call
          
        }
//3. function definition
        public static int addIntegers(int a, int b)//subfunction which returns the addition of two numbers
        {
            return (a + b);
        }


    }

The above example programs are examples of addition of 2 numbers Program,which can be written in more easier way but these programs are written using "Class"
in order to understand the difference between C++ and C# languages.
Both languages are object oriented languages.

The major difference between these two programming languages are:
1) We use header files in C++(EX:#include<iostream>) but we use namespaces in C#(EX:using system;)
2) A function is defined outside the class in C++ but the function should be defined in the same class in C#
3) Main should be outside the class in C++ but main should be with in the same class in C#
4) Finally syntax varies in both the languages.

Thats it Folks for today!!!
In upcoming days,i will come up with the proper definitions to all the technical words(EX:Namespaces etc.,) used in the above program,basic datatypes and other basic programming basics!!

7 comments:

Unknown said...

Thanks for this informative post.really u define very well example for C++ and C#.
Keep it up.

core java course

luckys said...

best weight machines

Julia Loi said...


Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man, Keep it up.


mobile phone repair in Auburn Hills
iphone repair in Auburn Hills
cell phone repair in Auburn Hills
tablet repair in Auburn Hills
ipad repair in Auburn Hills
mobile phone repair Auburn Hills
iphone repair Auburn Hills
cell phone repair Auburn Hills
phone repair Auburn Hills
tablet repair Auburn Hills

cheap hidden cameras
ismartalarm camera
dymo label maker
Waterproof Action Camera
Coleman full size air mattress
womens cotton long johns
APPLE WATCH SERIES 3 INFORMATION
Winter Cycling Jackets For Men

Janu said...

Thanks a lot for sharing such a good source with all, i appreciate your efforts taken for the same. I found this worth sharing and must share this with all.




Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery





MAZLUM TÜRK said...

kayseriescortu.com - alacam.org - xescortun.com

Anonymous said...

Smm Panel
smm panel
iş ilanları
instagram takipçi satın al
hirdavatciburada.com
WWW.BEYAZESYATEKNİKSERVİSİ.COM.TR
servis
tiktok jeton hilesi

Tenzin Jamtsho- Digital Marketer said...

Thank you for sharing a worthy content. Digital marketing course in Gurgaon

Post a Comment