{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


APSC171.2008.Lab01 - UBC Okanagan Engineering One APSC 171...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
UBC Okanagan Engineering One APSC 171 Lab 1 Page 1 of 3 APSC 171 Introduction to Electrical and Computer Engineering Lab 1 Writing Simple Programs and Introduction to Complier Errors Sec A Dr. Rteil Fri. Jan. 11, 2008 Sec B Mr. Wong Wed. Jan. 16, 2008 Sec C Dr. Tesfamariam Fri. Jan. 11, 2008 Sec D Dr. Tesfamariam Tue. Jan. 15, 2008 Sec E Dr. Milani Thu. Jan. 17, 2008 Sec F Dr. Milani Mon. Jan. 14, 2008 What to Do Before Your Lab Class Read Sections 1.1 – 1.3, 2.1 of “Engineering Problem Solving with C”. Also download and install Microsoft Visual C++ 2008 Express Edition on your laptop before attending this lab. Here is the link to download from: http://www.microsoft.com/express/download/ PART A: Writing and Running a Simple Program If you are running Windows... Start Microsoft Visual C++ 2008 Express Edition and select File -> New -> Project… Click on W32 on the left Panel and W32 Console Application on the Right Panel. Enter a project location for all your APSC171 labs (eg. APSC171) and a project name for today’s lab (e.g. for Lab1 Part A use Lab01A). Click OK, NEXT, FINISH. The left pane is an overview of your project and the right pane is your C++ program. Below the line #include "stdafx.h" , insert the line #include "stdlib.h" . Above return 0; enter the lines printf("Hello World! \n"); and system("PAUSE"); . If you like, you can rewrite the source file introduction line as int main(void). Save your program by selecting File -> Save. Or, simply press CNTRL-S. Compile the program by selecting Build -> Compile. Or, simply press CNTRL-F7. Run the program by double-clicking on the executable (EXE) file in your Project/Debug folder (browse through your files on your computer to find it first). Or, simply press F5.