visual c net introduction console applications cs 116 laboratory 1
Download
Skip this Video
Download Presentation
Visual C#.Net Introduction & Console Applications CS 116 – Laboratory 1

Loading in 2 Seconds...

play fullscreen
1 / 18

Visual C#.Net Introduction & Console Applications CS 116 – Laboratory 1 - PowerPoint PPT Presentation


  • 108 Views
  • Uploaded on

Visual C#.Net Introduction & Console Applications CS 116 – Laboratory 1. A Simple C# Console Application one that looks like a DOS window File -> New Project -> Console Application Take Note: Name, Location, Solution Name. Solution (. sln ) file

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Visual C#.Net Introduction & Console Applications CS 116 – Laboratory 1' - cher


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2

A Simple C# Console Application

one that looks like a DOS window

File -> New Project -> Console Application

Take Note: Name, Location, Solution Name

slide3

Solution (.sln) file

are the solution files. It stores info about the collection of projects that make up whatever you are developing. They contain projects, source control settings, or any other global level thing.

Solution User Options (.suo) file

are user settings files. Completely disposable, you can delete it and the most common thing you will lose are breakpoints.

slide4

CSProj file

the actual code projects (C# Libraries, WCF Services, etc). It stores information at the project level. It wraps all relevant References, Classess, etc.

App.config

At its simplest, the app.config is an XML file with built-in configuration sections and the ability to add your own custom settings.

slide5

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

Solution Explorer

Right side. This is where all the files for your project are.

slide6

Namespace keyword

Includes the name of your application. A namespace is a way to group related code together

The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.

slide7

Namespace keyword

Includes the name of your application. A namespace is a way to group related code together

The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.

slide8

Class keyword

Classes are declared using the keyword class.

[class] class identifier

{ class-body }[;]

All your code will be written in classes. This one is called Program

slide9

Method: Main

static void Main(string[] args)

{

}

When you run your programme, C# looks for a Method called Main. It uses the Main Method as the starting point for your programmes

slide10

Sample Program 1(Inside Class Program)

static void Main(string[] args)

{

Console.Write ("Hello World");

}

slide11

Sample Program 2(Inside Class Program)

static void Main(string[] args)

{

Console.Write ("Hello World");

Console.ReadKey();

}

slide12

Sample Program 3(Inside Class Program)

static void Main(string[] args)

{

Console.WriteLine("Hello World");

string fname;

Console.Write("Enter your first name: ");

fname = Console.ReadLine();

Console.WriteLine("Hello {0}", fname);

Console.ReadKey();

}

slide13

Sample Program 4(Inside Class Program)

static void Main(string[] args)

{

Console.WriteLine("Hello World");

string fname, lname;

Console.Write("Enter your first name: ");

fname = Console.ReadLine();

Console.Write("Enter your last name: ");

lname = Console.ReadLine();

Console.WriteLine("Hello {0} {1}!", fname,lname);

Console.ReadKey();

}

slide14

Sample Program 5(Inside Class Program)

static void Main(string[] args)

{

constint feet = 12;

intval, ans;

Console.WriteLine("Conversion inches to feet");

Console.Write("Enter your value in inches: ");

val = int.Parse(Console.ReadLine());

ans = val * feet;

Console.WriteLine("Value is {0}", ans);

Console.ReadKey();

}

slide15

Sample Program 6(Inside Class Program)

static void Main(string[] args)

{

Console.Write("Enter your value: ");

int x;

x = int.Parse(Console.ReadLine());

if (x < 10)

Console.Write("{0} is less than 10",x);

else

Console.Write("{0} is greater than 10",x);

Console.ReadKey();

}

slide16

Activity#1

First Name:

Last Name: Middle Name:Hi, Zyra O Bambico!Welcome to C# Programming.

slide17

Activity#2

Enter Num1:Enter Num2:Sum:Difference:Product:Quotient:

slide18

Activity#3

Enter Number:[Number] is EVEN.

ad