New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Program Appl in Elec Comp Engr

by: Karolann Wiegand

Program Appl in Elec Comp Engr ECE 3331

Marketplace > University of Houston > Electrical Engineering > ECE 3331 > Program Appl in Elec Comp Engr
Karolann Wiegand
GPA 3.51


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Electrical Engineering

This 4 page Class Notes was uploaded by Karolann Wiegand on Saturday September 19, 2015. The Class Notes belongs to ECE 3331 at University of Houston taught by Staff in Fall. Since its upload, it has received 10 views. For similar materials see /class/208308/ece-3331-university-of-houston in Electrical Engineering at University of Houston.


Reviews for Program Appl in Elec Comp Engr


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/19/15
Using Microsoft Visual C The Microsoft Visual C development environment is a software application used for writing CC programs The three main areas used when writing a program are the workspace the project and the source le A workspace is simply a container to easily organize projects A project is a container to hold any number of source les Typically all the source les in a project are interrelated often to produce a single executable program le The hierarchy of areas listed from highest to lowest is the workspace then the project and nally the source le You can build many different kinds of projects with Visual C For our purposes only one the console application is of interest A console application exe is a characterbased program that does not require screen graphics output It looks similar to a program running on a UNIX workstation or a terminal connected to a mainframe computer Console projects operate in a single window and let you interact with your program through normal read and write commands Console applications are better suited to problems that require pure numerical processing rather than graphical output or a graphical user interface This type of application is also more portable to other platforms than other types of applications Before launching the Visual C application you should do two things lBe sure your Windows Explorer is con gured NOT to hide known le extensions This is absolutely critical You should verify that this is correct EVERYTIME you sit down at a machine 2Create the directory on your H drive in which you want to work in this course ece3331 might be a good choice Of course on your own PC you can use the C drive but this is NOT where you should be working in a shared environment You only have to create the directory one time of course p Setting vour personal inxidc Visual Studio 1 Use spaces instead oftabs a Choose quottoolsquot then quotoptionsquot from the menu A dialog box should open b Choose the quottabsquot tab c For C and Fortran le types you should use spaces instead oftabs d Click OK 2 Use a xedwidth font for source windows and output windows a Choose quottoolsquot then quotoptionsquot from the menu A dialog box should open may already be open from the previous step b Choose the quotformatquot tab c Choose quotSource Windowsquot from the quotcategoryquot list box d In the quotfontquot section choose a xed width font such as quotCourier Newquot You may also want to use a xedwidth font for quotDebugger Windowsquot as well e Click OK Creating a Workspace 1 Once the Visual C program has been started choose the New option from the File dropdown menu at the top of the screen 2 A new dialog box will appear Choose the Workspaces tab update 12604 1 3 4 V39 Type a name for your workspace in the Workspace Name edit box for example semxx where semxx is the current semesterithis way if you have to repeat the course heaven forbid you will not get previous semester s cpl confused with this semester39s cpl Pick a location to save using the browse button a small button with an ellipses on it For example the hece3331 directory The directory must exist before you can choose it that is why you created it above Visual Studio will create a directory within the directory you choose and it will be assigned a name identical to your workspace name Click OK to create the workspace You only need to create the Workspace once assuming you want to save all of your quotprojectsquot in this same Workspace Creating a Project 1 4 gt19 To create a project within your workspace choose New from the File dropdown menu A dialog box will appear Make sure you are on the Project tab This should be the default tab when the dialog box appears Select Win32 Console Application from the list Type a name for your project in the Project Name edit box for example cpl might be a good choice Be sure you have the Add to current workspace button selected before proceeding This will place the new project within the workspace created earlier Note the location path When the next dialog appears make sure to choose An empty project and click Finish Click OK for the next dialog box On the left side of the Visual C application pane choose the File View tab Notice that your newly created project is nested within the workspace Notice that the words cpl files are in bold letters This means that this is the current project and any source files created will be added to this project Creating Source Files 5 V39 0 gt1 From the Project dropdown menu choose Add to Project and then New in the popout menu A dialog box will appear Make sure the Files tab is chosen This should be the default when the dialog box opens Choose C Source File in the list box Type the name ofyour source file in the File name edit box for example cplc might be a good choice You need to specify the c extension otherwise the program will automatically supply a cpp extension The compiler differentiates between C and C by the file extension so it is important to force the compiler into treating the program as a C program with the c extension If you have not turned off the quothide known extensionsquot option Windows will add the cpp extension after the c extension and you wind up with a file whose real name is cplccpp This may appear to execute properly in Windows but when you or we transfer it to unix and try to run it in the cc compiler it won t work You probably do not need to choose the location to save this file The current projects directory will be listed in the Location edit box Click OK and the source file will be created and opened You can now type your source code using the Visual C editor Save your source le update 12604 2 Compiling the Source Code Visual C allows you to compile either a single source le or the entire project assuming there are many les in a particular project this will not be the case for ECE 3331 1 To compile only one source le highlight the le from the Source Files list in the left hand pane of the Visual C application window From the Build dropdown menu choose Compile lenameext where lenameext will be the source le that you have highlighted 2 If errors arise during compilation of the source code they will be listed in the Build window at the bottom of the Visual C application window Simply doubleclick on the error message and the line of code that contains the error will be highlighted Correct the errors and resave your source le before recompiling Linking the Object File Once you have successfully compiled your source and an object le has been created you are then ready to quotlinkquot or as VC calls it quotbuildquot the executable le Using the quotbuildquot drop down menu select quotbuild the executablequot Any errors in the linking step will be displayed at the bottom of the screen If you have several source les you can compile and link them in a single step by initially choosing Build from the dropdown menu and then choosing Build project exe where project exe is the project you wish to create by compiling and linking This command will compile all source les within the project link their respective object les and create an executable le assuming there are no errors Running the Executable File If your program requires input data les they should be put into the quotprojectquot directory or you will need to specify the full path to the le in your quotopenquot statements Since such path information will not be valid when we run your programs in unix don t use the full path here Just copy the data le into the project directory If your program writes to a file that le will appear in the quotproj ectquot directory after execution From the quotbuildquot drop down menu select quotexecutequot or click on the icon on the toolbar A DOS command window will appear If there are statements requiring input from the keyboard execution will halt for you to enter the proper input and then continue If there are statements that output to the screen you will see the result If there are execution errors appropriate messages will appear When execution terminates you will see the quotpress any key to continuequot message If your output was directed to a le from the le menu select quotopenquot and you will be able to examine the leiassuming you have quotall lesquot selected in the open panel Debugging the Source Code One of the nice features of Microsoft Visual C is the debugging environment It is intuitive to follow and easy to learn 1 The debugger can only be employed when an executable le is made If the source code does not compile the debugger will not be available 2 To force the debugger to pause execution of the program prior to reaching its end breakpoints must be set within the program A breakpoint is a location in a process where execution is update 12604 3 stopped to allow the developer to examine the process39s code variables and register values and as necessary make changes continue execution or terminate execution To set a breakpoint at a sourcecode line do the following o In a source window move the insertion point to the line where you want the program to break Choose the Insert Remove Breakpoint toolbar button or press F9 A red dot appears in the left margin indicating that the breakpoint is set Note If you want to set a breakpoint on a source statement extending across two or more lines you must set the breakpoint on the last line of the statement To set a breakpoint at the beginning of a function or subroutine do the following o In the Find box on the Standard toolbar type the function or subroutine name 0 Click the InsertRemove Breakpoint toolbar button or press F9 0 While in debug mode a red dot appears in your source code in the left margin at the beginning of the function or subroutine indicating that the breakpoint is set To set a breakpoint at the return point of a function or subroutine do the following 0 Start debugging and pause the debugger in break mode program is waiting for user input after completing a debugging command On the View menu click Debug Windows then click Call Stack In the Call Stack window move the insertion point to the function or subroutine where you want the program to break Click the InsertRemove Breakpoint toolbar button or press F9 While in debug mode a red dot appears in the left margin of your source code indicating that the breakpoint is set To set a breakpoint at a label do the following o In the Find box on the Standard toolbar type the name of the label Click the InsertRemove Breakpoint toolbar button or press F9 While in debug mode a red dot appears in your source code in the left margin at the line containing the label indicating that the breakpoint is set To initiate the debugger choose Build from the dropdown menu then pick Start Debug and then select Go Pressing F5 will also start the debugger The program will then stop at the first breakpoint it encounters At this point there are several options for working through the program To continue to the next breakpoint press F5 To step into the next statement press Fll To step over the next statement press F10 To step out of a loop or subprogram press shiftFll To execute to the current cursor position press ctrlFlO Note all of the above commands are available on the debugging toolbar This toolbar becomes active as soon as the debug session is initiated It is possible during the debug session to view the value of most variables This is not possible if the variable is being held in a register To view the variables in the current subprogram press the Locals tab at the bottom of the application window To view a particular variable the variable name can be entered on one line of the watch window and its current value will be displayed E 4 U o o 9 o gt1 9 50 update 12604 4


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.