Skip to main content

C# Programming Structure | WaoFamHub



C# Programming Structure.

C# Programming Language


The lists of elements that are commonly used in a C# program are:

Library invoked by the keyword "using".
Declaring namespace using the "namespace" keyword.
Declaring a class using the keyword "class".
Class members and attributes.
The Main() method.
Other statements and expressions.
Writing comments for user understanding and non-executable statements.

Let's look into various parts of the above C# program.

/* Comments */

/* Print, some string in C# */, is the comment statement that does not get executed by the compiler and is used for code readers or programmers' understanding.

using

Here, using keyword is employed for fetching all the associated methods that are within the System namespace. Any C# program can have multiple using statements.

namespace

Next statement is used for declaring a namespace, which is a collection of classes under a single unit; here "printHelloCsharp".

Class

Next, you have declared a class "HelloCsharp" using the keyword class, which is used for preserving the concept of encapsulation.

main()

Inside a class, you can have multiple methods and declaring variable names. The static/void is a return value, which will be explained in a while.

Console.WriteLine()

Console.WriteLine() is a predefined method used for displaying any string or variable's value in a C# program.

Console.ReadKey()

Console.ReadKey() is another predefined method used to make the program wait for any key-press.


Comments

Post a Comment

Popular posts from this blog

Variables In C# | WaoFamHub

What Are Variables In C#. Variables are specific names given to locations in the memory for storing and dealing with data. The values of a variable can be changed or reused as many times as possible. Every variable name has a specific type that resolves the size and layout of memory the variable will hold as well as the range of values that variable within your program can hold. Also, programmers can determine which variables can be applied to which type of operation. Types Of C# Variables. The basic types of variables that can be formed in a C# program are: Integral typessbyte, byte, short, ushort, int, uint, long, ulong, and char Floating-point types float and double Decimal types decimal Boolean types true or false values, as assigned Nullable types Nullable data types Define Variables In C#. For implementing variables in a C# program, you have to define them before use. To do this, the syntax is: <data_type> <variable_names> ; Here data_types will be a valid data type (...

Draw The Walking Man On The Screen Program In C | BGI | WaoFamHub

Draw The Walking Man On The Screen Program In C INPUT #include<stdio.h> #include<graphics.h> #define ScreenWidth getmaxx() #define ScreenHeight getmaxy() #define GroundY ScreenHeight*0.75 int ldaisp=0; void DrawManWithUmbrella(int a,int ldaisp) { //Draw Umbrella pieslice(a+20,GroundY-120,0,180,40); line(a+20,GroundY-120,a+20,GroundY-70); //Draw head circle(a,GroundY-90,10); line(a,GroundY-80,a,GroundY-30); //Draw hand line(a,GroundY-70,a+10,GroundY-60); line(a,GroundY-65,a+10,GroundY-55); line(a+10,GroundY-60,a+20,GroundY-70); line(a+10,GroundY-55,a+20,GroundY-70); //Draw legs line(a,GroundY-30,a+ldaisp,GroundY); line(a,GroundY-30,a-ldaisp,GroundY); } void Rain(int a) { int i,rx,ry; for(i=0;i<400;i++) { rx=rand() % ScreenWidth; ry=rand() % ScreenHeight; if(ry<GroundY-4) { if(ry<GroundY-120 || (ry>GroundY-120 && (rx<a-20 || rx>a+60))) line(rx,ry,rx+0.5,ry+4); } } } void main() { int gd=DETECT,gm,a=0; initgraph(&gd,&gm,"C:\\TC\\BGI"...

Software Engineering - Spiral Model | WaoFamHub

Spiral Model The spiral model, initially proposed by Boehm, is an evolutionary software process model that couples the iterative feature of prototyping with the controlled and systematic aspects of the linear sequential model. It implements the potential for rapid development of new versions of the software. Using the spiral model, the software is developed in a series of incremental releases. During the early iterations, the additional release may be a paper model or prototype. During later iterations, more and more complete versions of the engineered system are produced. Each cycle in the spiral is divided into four parts: Objective setting: Each cycle in the spiral starts with the identification of purpose for that cycle, the various alternatives that are possible for achieving the targets, and the constraints that exists. Risk Assessment and reduction: The next phase in the cycle is to calculate these various alternatives based on the goals and constraints. The focus of evaluation ...

What is Software Engineering? | WaoFamHub

What is Software Engineering? Software engineering is defined as a process of analyzing user requirements and then designing, building, and testing software application which will satisfy those requirements. Let's look at the various definitions of software engineering: IEEE, in its standard 610.12-1990, defines software engineering as the application of a systematic, disciplined, which is a computable approach for the development, operation, and maintenance of software. Fritz Bauer defined it as 'the establishment and used standard engineering principles. It helps you to obtain, economically, software which is reliable and works efficiently on the real machines'. Boehm defines software engineering, which involves, 'the practical application of scientific knowledge to the creative design and building of computer programs. It also includes associated documentation needed for developing, operating, and maintaining them.'

What Is C Programming? | Why To Learn C Programming | WaoFamHub

What Is C Programming C programming is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system. C is the most widely used computer language. It keeps fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used among modern software programmers. Why to Learn C Programming? C programming language is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Software Development Domain. I will list down some of the key advantages of learning C Programming: Easy to learn Structured language It produces efficient programs It can handle low-level activities It can be compiled on a variety of computer platforms Facts about C C was invented to write an operating system called UNIX. C is a successor of B language which was introduced aroun...

Write a java program to implement single level inheritance. | WaoFamHub

Single Level Inheritance.  INPUT class Single{  static int num1=10;  static int num2=5; } class Main extends Single{  public static void main(String[] args){  int num3=2;  int result=num1+num2+num3;  System.out.println("Result of child class is "+result);  } } OUTPUT