Week6_Workshop_Full-1

Remember only assignment engineering statements

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ember, only ‘assignment’ Engineering statements require the semicolon. Education Example fprintf (output) syntax General Form: fprintf ( ‘ format ’ , Var) Where format contains text and a format field (%f or %s) for each variable to be output fprintf(' \n Surface area is %f square inches.\n ' , SA) ‘Carriage’ Return to start printing a new line Location within the output for a number to be printed Register that holds the number to be printed Result: Surface area is 54.3400 square inches. >> % notice the output units are included in the format statement Engineering in this example they are not a variable in this example. Education Output Syntax General Form: fprintf ( ‘ format ’ , Var1, Var2, Var3) To output more than one variable you can use multiple fprintf statements (one for each variable) or you can output more than one variable with a single fprintf statement. You can also control the number of decimal places printed. fprintf(‘\n Alpha = %6.2f %s and Beta = %.3f %s\n’,...
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.

Ask a homework question - tutors are online