Fall 2016 Programming Tutorial

Fall 2016 Programming Tutorial

EK132 Introduction to Engineering - Fall 2016 Programming Tutorial 1. Set up options a. Online You can start learning C# programming language using online programming environments. For example: http://www.compileonline.com/. Table 1: Hello World Program // Hello.cs using System; public class Hello { public static void Main() { Console.WriteLine("Hello, World!"); } } b. Local Setup You can also set up your own environment for C programming. For that you will need the following two software tools available on your computer, (a) Text Editor and (b) The C# Compiler. Text Editor: It is used to type your program. Examples of a few editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi. Compilation Information http://rextester.com/ https://www.tutorialspoint.com/compile_csharp_online.php The Mono C# compiler http://www.mono-project.com/docs/about-mono/languages/csharp/ Class room set up (PHO 115) We will be using in Visual Studio 2013 for our class hands-on and laboratory activities. To create a C Project in Visual Studio, follow these steps: 1) Open Visual Studio 2) Select File –> New –> Project… 3) When the New Project dialog box appears select Visual C# in the left pane. Templates -> Visual C# 4) In the Project window, select Win32 Console Application 5) Give an appropriate name to the project 6) Click the OK button You now have a new “C#” project. To create the actual C# program: 7) Enter the Hello world program and save. 8) Select BUILD -> Build Solution 9) Run 2. More Examples Try the following examples: // Try with m = 5 and then with m = 4. int m = 6; int n = 9; if (m > 10) if (n > 20) { Console.WriteLine("Test 1"); } else { Console.WriteLine("Test 2"); } public class EKObject { public int value; } public static void Test() { EKObject obj = new EKObject(); obj.value = 12; ModifyObject(obj); Console.WriteLine(obj.value); } static void ModifyObject(EKObject obj) { obj.value = 33; } .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us