Lab Activity - C# Programming Lab 1 PDF
Document Details
Uploaded by EasierCarnelian633
Tags
Summary
This document is a lab activity on C# programming, focusing on using Visual Studio IDE for creating and running simple C# applications, including tasks on writing code and printing shapes. The document guides students through the process of creating console applications and printing out specific shapes using code.
Full Transcript
Lab Activity Lab 1 Overview In this practice, we compile and run C# program using visual studio IDE. In addition, we explore some features of an IDE that let us to develop applications quickly and easily. Assumptions The visual studio IDE is...
Lab Activity Lab 1 Overview In this practice, we compile and run C# program using visual studio IDE. In addition, we explore some features of an IDE that let us to develop applications quickly and easily. Assumptions The visual studio IDE is installed on the computer. Understanding the general form of printing statements (Console.Write() and Console.WriteLine( ) ). Task 1 1. Double-Click the visual studio icon. 2. When the visual studio opens, select create new project. 3. Select C# and Console Application 235 Lab Activity Lab 1 4. Name the application and set the location 5. When the wizard finished, the following editor will be appears 236 Lab Activity Lab 1 6. Write the following statements in the editor Console.Write("***\n "); Console.Write("***"); 7. Select debug Menu or Press F5 from the keyboard to run the application. The output of the application will be appears in the output window and look like this: *** *** 8. Close the output window and back to the editor. 9. Replace the first statement Console.Write("***\n"); with the following statement Console.WriteLine("***"); 10.Again Press F5 to run the application. The output will appears as the following: *** *** Now we have seen how to run a simple C# program using visual studio IDE. 11. Save the project. 237 Lab Activity Lab 1 Task 2 1. Now you will have to create new project named SecondSimpleApp. 2. Write the following statements in the editor: Console.Write("**"); Console.Write("*\n"); Console.Write("**"); Console.Write("\n*"); 3. Run the program and write the output. 4. Close the output window and back to the editor. 5. Replace the second statement with Console.WriteLine("*"); 6. Run the program and write the output. 7. Close the output window and back to the editor. 8. Modify the code to print the following shape using only a sequence of Console.Write() statement. ***** **** *** ** * 238 Lab Activity Lab 1 9. Modify the code to print the following shape using only a sequence of Console.WriteLine() statement. * ** *** **** ***** 10. Modify the code to print the following shape using only a sequence of Console.WriteLine() statement. * *** ***** ******* ********* 11. Modify the code to print the following shape using only a sequence of Console.WriteLine() statement. ********* ******* ***** *** * 239