Posts

Showing posts from October, 2023

Writing 1st program of C#

Image
  Rules to be followed.   You need to produce high quality C# Code. Here are some rules you may follow.   1. Keep everything simple and clean             Avoid complex coding in your program if you have complex program then use your time to analysis and divide into subtasks.   2. Be consistent             Be consistent as much as possible whatever you do. This is especially important when writing your code against your coding rules-coding standards.     3. Have a coding standard             A coding standard defines how you write your code.               1. For class names use Pascal Casing             2. For Function names use Pascal Casing    ...

Structure of C# Program

  A C# program consists of the following parts −   ·        Namespace declaration ·        A class ·        Class methods ·        Class attributes ·        A Main method ·        Statements and Expressions ·        Comments   Ex :   using System;   namespace HelloWorldApplication {    class HelloWorld {       static void Main(string[] args) {          /* my first program in C# */          Console.WriteLine("Hello World");          Console.ReadKey();       }    } }   Explanation :   ·      ...

Structure of Java Program

Java program is having below sections.   ·        Package declaration ·        Import statements ·        Comments ·        Class definition ·        Class variables, Local variables ·        Main Method ·        Methods/Behaviors   Package declaration : A class in Java can be placed in different directories/packages based on the module they are used.   Import Statements : There can be classes written in other folders/packages of our working java project and also there are many classes written by individuals, companies, etc which can be useful in our program   Comments: The comments in Java can be used to provide information about the variable, method, class or any other statement   Class definition : A name should be given to a ...

Structure of C++ Program

  A C++ program is structured in a specific and particular manner. In C++, a program is divided into the following three sections:   ·        Standard Libraries Section ·        Main Function Section ·        Function Body Section   For example , let’s look at the implementation of the Hello World program   #include <iostream> using namespace std;   int main() {   cout << "Hello World!" << endl;   return 0; }     Standard libraries   #include <iostream> using namespace std;   #include is a specific preprocessor command that effectively copies and pastes the entire text of the file, specified between the angle brackets, into the source code.   The file <iostream>, which is a standard file that should come with the C++ compiler, is short for input-output streams. This...

Structure of C Program

  The basic structure of a C program is divided into 6 parts which makes it easy to read, modify, document, and understand in a particular format. C program must follow the  below-mentioned outline in order to successfully compile and execute. Debugging is easier in a well-structured C program.   Sections of the C Program There are 6 basic sections responsible for the proper execution of a program. Sections are mentioned below:   1.      Documentation 2.      Preprocessor Section 3.      Definition 4.      Global Declaration 5.      Main() Function 6.      Sub Programs   Documentation : This section consists of the description of the program, the name of the program, and the creation date and time of the program. It is specified at the start of the program in the form of comments. Documentation can be represented as: ...