Unformatted text preview: t mean to suppress echo? How do you do
How do you add comments to your program?
You should add “help” comments at the top of each
program that indicate who wrote the program and when
and what the program does.
Education Clearing the workspace
Before you run a program, it is good practice to
clear the workspace(clear). You may also want to
clear the command window(clc)
clear; clc % the ; can be used to separate commands
on a single line….but not recommended Make the line COST = a comment and run the
program without clearing the workspace.
Do you get the same values of COST and GASUSED as
before? Now clear the workspace and run.
What error do you get? Engineering
Education Trip Program
Add code to output the amount of
gas used in the trip and the
We will use the “fprintf” command
to generate output. fprintf('\nYou need %f gallons which will cost $%.2f',GASUSED,COST) Save and run your file (be sure to put semicolons on the end of the GASUSED =
and COST = lines to suppress the echo). Rem...
View Full Document
This note was uploaded on 01/28/2014 for the course ENGE 1114 taught by Professor Twknott during the Spring '06 term at Virginia Tech.
- Spring '06