The document provides instructions on how to execute C# programs and includes examples of simple C# programs. It discusses installing the .NET framework, setting the PATH variable, using commands like "csc" and "dotnet" to compile and run programs. Example programs shown include adding two numbers, displaying command line arguments, using the Math class, and handling exceptions. Custom exception classes are also demonstrated.
Programming Fundamentals Functions in C and typesimtiazalijoono
Programming Fundamentals
Functions in C
Lecture Outline
• Functions
• Function declaration
• Function call
• Function definition
– Passing arguments to function
1) Passing constants
2) Passing variables
– Pass by value
– Returning values from functions
• Preprocessor directives
• Local and external variables
Programming Fundamentals Functions in C and typesimtiazalijoono
Programming Fundamentals
Functions in C
Lecture Outline
• Functions
• Function declaration
• Function call
• Function definition
– Passing arguments to function
1) Passing constants
2) Passing variables
– Pass by value
– Returning values from functions
• Preprocessor directives
• Local and external variables
The ppt describes usage of functions in c language. Showing basic use of function and determining the differences between function call by value and function call by reference using pointer. It also includes valid use in swapping two numbers in c along with different outputs. Overall its a basic note for c language.
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
Function is a set of statement which is designed to perform some specific task. Function gives functionality to programmer to use one module(task) for more times rather then write same code again and again....
The ppt describes usage of functions in c language. Showing basic use of function and determining the differences between function call by value and function call by reference using pointer. It also includes valid use in swapping two numbers in c along with different outputs. Overall its a basic note for c language.
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
Function is a set of statement which is designed to perform some specific task. Function gives functionality to programmer to use one module(task) for more times rather then write same code again and again....
Guidelines for Modelling Groundwater Surface Water Interaction in eWater SourceeWater
One of the key challenges in modelling GW-SW interactions is the significant time-scale
differences between surface water and groundwater processes. Because groundwater
movement can be orders of magnitude slower than surface water movement, the
responses of groundwater systems to hydrological and management drivers such as
climate variability, land use change, and groundwater extraction can be very damped and
lagged. Hence, a key requirement in modelling GW-SW interactions in river system
models is to account for these time lags.
The modelling of GW-SW interactions in river system models is still very much in its
infancy, not just in Australia, but also throughout the world. As such, there is no consensus
on implementation of this functionality in river system models, and hence the little
discussion in the literature so far on what constitutes Best Practice Modelling in this
domain.
Survey Grade LiDAR Technologies for Transportation EngineeringQuantum Spatial
This presentation was given during the 2013 Annual Civil Engineering Conference by Tim Stagg of AeroMetric. It covers system/sensor configurations, application advantages/disadvantages, analysis from sensor data, feature extraction/deliverables, and client pains in relation to survey grade LiDAR technologies for transportation engineering.
Topics: Introduction to PHP
To know more about
Offer- http://mazenet-chennai.in/mazenet-offers.html
Syllabus- http://mazenet-chennai.in/php-training-in-chennai.html
For more events- http://mazenet-chennai.in/mazenet-events.html
All videos- https://www.youtube.com/c/Mazenetsolution
Facebook- https://www.facebook.com/Mazenet.IT.Solution/
Twitter- https://twitter.com/Maze_net
Mail us : marketing@mazenetsolution.com
Contact: 9629728714
Preparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability ExtensionSafe Software
Find out how to quickly prepare LiDAR data for use in ArcGIS 10.1 with the Data Interoperability Extension. Through demos, you’ll see how to perform: format translation; coordinate system re-projection; and integration with GIS, CAD, and raster data on millions of points in seconds. You'll also learn how to clip, tile, split, combine and more - overall enabling you to prepare LiDAR data according to your precise requirements and use it immediately in ArcGIS.
Q3 GIVEN THE TREND EQUATION NO OF STUDENTS-3000+200 YEAR BASE: 2003-0
1.INTERPRET EQUATION RESULTS 2.FORECAST FOR 2020 3.WHEN WILL THE NO OF
STUDENTS REACH 6000
Solution
x no of years from 2003 y no of students y = 3000+200x 1) The regression
equation has a positive slope of 200 y intercept is 3000 i.e. no of students in the year 2000
Thus for every year 200 students increase 2) For 2020, x = 17, y = 3000+200(17) = 6400
3) When y =6000, 6000 = 3000+200x or x = 15 Hence in year 2018 students reach 6000
B Regression C D. All the above.
2. How to execute a C# program?
Install setup package named dotNetFx40_Full_setup.exe can be
downloaded from Microsoft’s general download area
http://www.microsoft.com/en-us/download/details.aspx?id=17851
Set Path varable through Mycomputer’s property –Environment
Variable
PATH: C:WINDOWSMicrosoft.NETFrameworkv4.0.30319
Use Command prompt and then type the following command for
compilation :
c:mydircsc programname.cs
To run the C# program
c:mydirprogramname
Prof. Syed Mustafa(Ph.D) 2
3. Program to add 2 numbers
// type the program in notepad & save the program as
“add.cs”
using System;
class add
{
public static void Main()
{
Console.WriteLine("Enter 2 numbers");
int a=int.Parse(Console.ReadLine());
int b=int.Parse(Console.ReadLine());
int c=a+b;
Console.WriteLine("sum of "+a+" and "+b+" is "+c);
}
}
Prof. Syed Mustafa(Ph.D) 3
4. Program to display Command line
arguments
// type the program in notepad & save the program as
“cmd.cs”
using System;
class cmd
{
public static void Main(string[] s )
{
Console.WriteLine("command line arguments");
for(int i=0;i<s.Length;i++)
Console.WriteLine(s[i]);
}
}
Prof. Syed Mustafa(Ph.D) 4
5. Program to display Command line
arguments
// type the program in notepad & save the program as
“cmd.cs”
using System;
class cmd
{
public static void Main(string[] s )
{
Console.WriteLine("command line arguments");
foreach(string i in s)
Console.WriteLine(i);
}
}
Prof. Syed Mustafa(Ph.D) 5
6. Program to display Command line
arguments
// type the program in notepad & save the program as
“cmd.cs”
using System;
class cmd
{
public static void Main(string[] s )
{
string[] a=Environment.GetCommandLineArgs();
Console.WriteLine("command line arguments");
for(int i=1;i<a.Length;i++) //s[0] is cmd.cs, here s[1] is
first argument
Console.WriteLine(a[i]);
}
} Prof. Syed Mustafa(Ph.D) 6
7. Program to use Math class
using System;
class sqt
{
public static void Main()
{
Console.WriteLine("Enter number");
int n=int.Parse(Console.ReadLine());
double r=Math.Sqrt(n);
Console.WriteLine("square root of "+n+" is "+r);
}
}
Prof. Syed Mustafa(Ph.D) 7
8. Program to use Exception
using System;
class Except1
{
public static void Main()
{
try{
int a=5,b=0;
Console.Write(“Multiple Exception");
int c=a/b;
Console.WriteLine("C="+c);
}catch(DivideByZeroException e)
{
Console.WriteLine("Divide by 0 Error");
}catch(ArithmeticException ae)
{
Console.WriteLine("Arithmetic Error");
}
}
}
Prof. Syed Mustafa(Ph.D) 8
9. Program to use Exception
using System;
class Except1
{
public static void Main()
{
try{
int a=5,b=0;
Console.Write(“Multiple Exception");
int c=a/b;
Console.WriteLine("C="+c);
}catch(DivideByZeroException e)
{
Console.WriteLine("Divide by 0 Error");
}catch(ArithmeticException ae)
{
Console.WriteLine("Arithmetic Error");
} finally
{
Console.WriteLine("From finally...");
}
}
}
Prof. Syed Mustafa(Ph.D) 9
10. Program to use Exception
using System;
class Except3
{
public static void Main()
{
try{
int age=14;
if (age<15) throw new ArithmeticException();
Console.WriteLine("Age=" + age);
}catch(ArithmeticException ae)
{
Console.WriteLine("Age Error...");
}finally
{
Console.WriteLine("From finally...");
}
}
}
Prof. Syed Mustafa(Ph.D) 10
11. Program to use Exception
using System;
class Except4
{
public static void Main()
{
int a=893434,b=78888;
try{
int c=checked(a*b);
Console.WriteLine("a=" + a);
}catch(OverflowException ae)
{
Console.WriteLine("Overflow Error...“+ae.Message);
Console.WriteLine(“Source Error...“+ae.Source);
}finally
{
Console.WriteLine("From finally...");
}
}
}
Prof. Syed Mustafa(Ph.D) 11
12. Program to use Exception
using System;
class Except
{
public static void Main()
{
try{
int a=5,b=0;
Console.WriteLine(“Exception");
int c=a/b;
Console.WriteLine("C="+c);
}catch(DivideByZeroException e)
{
Console.WriteLine("Divide by 0 Error: "+e);
Console.WriteLine("Error Message is: "+e.Message);
Console.WriteLine("Stack trace is: "+e.StackTrace);
Console.WriteLine("Error Source is: "+e.Source);
Console.WriteLine("Target Site is: "+e.TargetSite);
Console.WriteLine("HelpLink is: "+e.HelpLink);
}
}
}
Prof. Syed Mustafa(Ph.D) 12
13. Program to use customized Exception
using System;
class AgeException:Exception
{public AgeException(String msg):base(msg){ }
}
class Except4custom
{public static void Main()
{ int age=4;
try{
if(age<15) throw new AgeException("Under Age");
Console.WriteLine("age=" + age);
}catch(AgeException ae)
{
Console.WriteLine("Error is...:"+ae);
}finally
{
Console.WriteLine("From finally...");
}
}
}
Prof. Syed Mustafa(Ph.D) 13
14. Program to use customized Exception
using System;
class AgeException:Exception
{String m;
public AgeException(String msg)
{m=msg;
}
public override string Message
{
get { return m; }
}
}
class Except4custom2
{public static void Main()
{ int age=4;
try{
if(age<15) throw new AgeException("Under Age");
Console.WriteLine("age=" + age);
}catch(AgeException ae)
{
Console.WriteLine("Error is...:"+ae.Message);
}
}
Prof. Syed Mustafa(Ph.D) 14
}
15. Program to use customized Exception
using System;
class AgeException:Exception
{ String m;
public AgeException(String msg)
{m=msg;
}
public override string Message
{
get { m+="Age is not valid"; return m; }
}
}
class Except4custom1
{ public static void Main()
{ int age=4;
try{
if(age<15) throw new AgeException("Under Age");
Console.WriteLine("age=" + age);
}catch(AgeException ae)
{
Console.WriteLine("Error is...:"+ae.Message);
}
}
Prof. Syed Mustafa(Ph.D) 15
}