Programming Fundamental Lab Manual (Lab 1) BSCS 1st E

Topic: Introduction to IDE & Programming Course Instructor: Eisha Tir Razia Lab Instructor: Ausaf Sharif

Session: Fall 2017

Department of CS & IT

Objective: The objective of the lab is to understand how to use the DevC++ compiler and how to run and compile a C++ program and to introduce with comments and escape sequences in the program. The basic introduction of C++ program is also done in this lab and Learn how to write and run C++ Program. At the end of this lab students will able to write some basic program and also run it.

What is IDE? IDE stands for integrated development environment. It is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of a source code editor, build automation tools and a debugger There are number of IDEs available for compilation of C/C++ code, here we use Dev C++. It is easily available on net. https://sourceforge.net/projects/dev-cpp/files/Binaries/Dev-C%2B%2B%204.9.9.2/devcpp4.9.9.2_nomingw_setup.exe/download?use_mirror=excellmedia

How to install DevC++ Watch this video tutorial for step by step guide for installation https://www.youtube.com/watch?v=Bdde1NxLLtQ

How to write and Compile in Dev C++ The following figures show how to compile and run a C++ program in Dev C++ Step 1: Locate the Dev C++ shortcut and open it. You might find it at your desktop (It is supposed that you already have installed it). Step 2: Click on File button shown in above bar then click on New and then click on source file. Step 3: Write your C++ program

Step 4: Save your program

Step 5: Compile the program using F9 OR Execute > Compile.

Step 6: Press F10 to Run (or select Execute > Run in menu bar).

Getting Started with C++ The C language facilitates a structured and disciplined approach to computer program design uses some notations that may appear strange to people who have not programmed computers. We begin by considering a simple C program. Our first example prints a line of text. Following is a simple C program. #include void main() { cout<<”Hello Class”; getch(); }

Description: 

“void main() ” is a part of every C++ program.



The parentheses after main indicate that main is a program building block called a function. C++ programs contain one or more functions, one of which must be main. As we discussed above that every program in C++ begins executing at the function main.



Functions can return information. The keyword ‘int’ to the left of main indicates that main “returns” an integer (whole number) value. We’ll explain what it means for a function to “return a value” when we demonstrate how to create your own functions. For now, simply include the keyword int to the left of main in each of your programs.



return 0 is included at the end of every main function. The keyword return is one of several means. We will use it to exit a function. When the return statement is used at the end of main as shown here, the value 0 indicates that the program has terminated successfully. We will discuss the reasons for including this statement later. For now, simply include this statement in each program, or the compiler might produce a warning on some systems.



The "curly braces" { and } signal the beginning and end of functions and other code blocks. These are also called delimiters.



; is known as statement terminator. It tells the compiler that a particular statement (containing one or more than one lines) has finished.

Comments A "comment" is a sequence of characters beginning with a forward slash and asterisk combination /*. Comment is not a part of program and ignored by the compiler during compilation process. A comment can include any combination of characters. End of comment is shown by delimiter (*/). Comments can occupy more than one line but cannot be nested. Use comments to document your code. This example is a comment accepted by the compiler: Examples: 1. /*This is the multi-line comment syntax*/ 2. // This is a valid comment

Lab Tasks Task 1: Write a c++ program to print her/his name, id, address, phone number to display the text on the screen like that? Sample Output:

Ali 12003065299 Mintgumri Road Lahore

Task 2: Write five C++ statements to print the asterisk pattern as shown below using printf? Sample Output:

* ** *** **** *****

Task 3: What does the following code print? printf("*\n**\n***\n****\n*****\n" );

Task 4: Write a program that prints the following shapes with asterisks.

Task 6: Write a program to output the following on the screen: *************************** * * * * Welcome to UOS, Lahore!! * * * * ***************************

Lab Manual 1 (BSCS-1st-E)-2.pdf

consists of a source code editor, build automation tools and a debugger. There are number of IDEs available for compilation of C/C++ code, here we use Dev ...

339KB Sizes 1 Downloads 138 Views

Recommend Documents

Introduction-To-Networks-Lab-Manual-V5-1-Lab-Companion.pdf ...
3. Page 3 of 3. Introduction-To-Networks-Lab-Manual-V5-1-Lab-Companion.pdf. Introduction-To-Networks-Lab-Manual-V5-1-Lab-Companion.pdf. Open. Extract.

Lab Manual
OBJECTIVES. 1. Investigate how to use a multimeter to measure voltage across a circuit component. ..... The bandwidth of this circuit is ω_H=1/RC. Compute the ...

Lab#1
Work environment. • Logging on the lab PC: Linux. • Lab Server: zoltar.redes.upv.es netcat usage( see Appendix A). • connect as a client to zoltar.redes.upv.es o www.upv.es: echo (7) daytime (13). • use netcat for a full connection, both serv

Lab # 1
Solution is in page 2. Lab 3. Problem 1: Fashion factory ... First Semester: 2013-2014 bi ? 288 – 57.6

Download [Epub] CCNP SWITCH Lab Manual (Lab Companion) Read online
CCNP SWITCH Lab Manual (Lab Companion) Download at => https://pdfkulonline13e1.blogspot.com/1587134012 CCNP SWITCH Lab Manual (Lab Companion) pdf download, CCNP SWITCH Lab Manual (Lab Companion) audiobook download, CCNP SWITCH Lab Manual (Lab Com

PDF Online CCNP ROUTE Lab Manual (Lab Companion)
The Cisco. Networking Academy curriculum consists of three experience-oriented courses that employ industry-relevant instructional approaches to prepare students for professional-level jobs: CCNP ROUTE: Implementing IP Routing, CCNP SWITCH: Implement

Download CCNP SWITCH Lab Manual (Lab Companion) Full Books
CCNP SWITCH Lab Manual (Lab Companion) Download at => https://pdfkulonline13e1.blogspot.com/1587134012 CCNP SWITCH Lab Manual (Lab Companion) pdf download, CCNP SWITCH Lab Manual (Lab Companion) audiobook download, CCNP SWITCH Lab Manual (Lab Com