Docsity

C# Programming Fundamentals: Variables, Data Types, Control Structures, and GUI, Lecture notes of Programming Languages

Partial preview of the text

Download C# Programming Fundamentals: Variables, Data Types, Control Structures, and GUI and more Lecture notes Programming Languages in PDF only on Docsity!

CHAPTER ONE

INTRODUCTION TO VISUAL

PROGRAMMING

Command Line Interface (CLI)

 A command-line interface (CLI) is a mechanism for

interacting with a computer operating system or software

by typing commands to perform specific tasks.

 Until the mid-1980s, computer interfaces were based on a

text-based delivery model often called a "command line

interface (CLI) ".

 The screen consisted of a number of lines (typically 25 or

more), each with 80 or more characters.

Cont…

 These commands are very specific, for example in

DOS you could type in:

 copy c:\item.txt d:\

 That tells the machine to copy the file 'item.txt' that

resides in the root directory of drive C: into the root

directory of drive D:\

Cont…  (^) Before windows was developed, this type of user interface was what most people used to get the computer to follow instructions.  (^) Nowadays, very few people have the knowledge to be able to use a command line interface  (^) An example of this type of interface is DOS

Disadvantages of a CLI  (^) For someone who has never used a CLI it can be very confusing.  (^) Commands have to be typed in precisely, if there is a spelling error the command will fail.  (^) If you mis-type an instruction, it is often necessary to start all over again  (^) There are a large number of commands which need to be learned - in the case of Unix, it can be hundreds.  (^) You can't just guess what the instruction might be and you can't just 'have a go'

GUI(windows programming interface)  (^) A graphical user interface (GUI) is a pictorial interface to a program.  (^) A good GUI can make programs easier to use by providing them with a consistent appearance and with intuitive controls like buttons, list boxes, textbox, label, menus, and so forth  (^) The components graphical user interface discussed in this section are  (^) Text boxes  (^) Frames  (^) Command buttons  (^) Checkboxes  (^) Radio buttons  (^) Popup menus  (^) List Boxes

05/06/2025 C# 10

Cont…  (^) All modern operating systems have at least one type of GUI.  (^) For example :  (^) Microsoft Windows is a GUI,  (^) Apple Macintosh has another.  (^) Linux has a number of Graphical User Interfaces available.  (^) Many programs that run in Windows are known as WYSIWYG - this stands for W hat Y ou S ee I s W hat Y ou G et.  (^) whatever you create on the screen will be very similar to what appears on the printer or world-wide-web.  (^) In the early days of word-processors, you typed your essay or letter on the screen, but it could look completely different on the printer.

Advantages of a GUI  (^) This type of user interface is extremely easy to use, especially for a beginner  (^) It is easy to explore and find your way around the system using a GUI  (^) You do not have to learn complicated commands  (^) There are usually good help facilities provided with GUIs  (^) You get the benefit of WYSIWYG  (^) It can be user-friendly and speed up the user's work  (^) It can be more attractive for non-technical people  (^) In general, it looks more professional (but this does not mean it is always the best solution).

Windows-based Programming Tools  (^) There are many tools for programming Windows-based applications; they range from Assembler to COBOL and FORTRAN to the following:

 Microsoft Visual C#, Microsoft Visual Basic, Borland C++, native UNIX C and C++ tools, and others.
 Borland C++, native UNIX C and C++ tools, and others.
 Java (various commercial vendors, for Windows, Macintosh, and UNIX)
 Smalltalk
 Delphi
 PowerBuilder
 The key with many of these tools is ease-of-development versus "program execution efficiency."

 While all of these tools can be used to create applications, some are easier than others to develop

programs with.

 Many of the development environments listed above have graphical development features that

enable you to rapidly develop software applications that run by themselves or within other

applications (macros).

Assignment

1. What is the first window programming language?

2. What is the first CLI programming language?

3. What is the first GUI operating system?

4. Why GUI need more memory (RAM) and height

amount of hard disk space than CLI?

Note: Not more than one page

Content Working with Variable Data Types Data type conversion Operators Precedence and Associatively Incrementing and Decrementing Variables Comments in C# Concatenation

Working with Variable

Identifiers  (^) Identifiers are the names you use to identify the elements in your programs, such as namespaces, classes, methods, key words, and variables.  (^) In C#, you must adhere to the following syntax rules when choosing identifiers:  (^) : You can use only letters (uppercase and lowercase), digits, and underscore characters.

 An identifier must start with a letter or an underscore.

 (^) For example, result , _score , footballTeam , and plan9 are all valid identifiers, whereas result% , footballTeam$ , and 9plan are not.  (^) Note C# is a case-sensitive language footballTeam and FootballTeam are not the same identifier.

Cont…

Cont…  (^) The following identifiers are not reserved by C#, which means that you can use these names as identifiers for your own methods, variables, and classes, but you should really avoid doing so if at all possible.