11
Free Powerpoint Templates Free Powerpoint Templates ARVIN santos buendia

Quiz01 and format specifier

Embed Size (px)

DESCRIPTION

for 4th quarter computer LT review

Citation preview

Page 1: Quiz01 and format specifier

Free Powerpoint TemplatesFree Powerpoint TemplatesARVINsantosbuendia

Page 2: Quiz01 and format specifier

Free Powerpoint Templates

OBJECTIVES

Take Quiz 01

Explain Format Specifier

Enumerate the Different Format Specifier in Turbo-C

Evaluate Format Specifier

Page 3: Quiz01 and format specifier

Free Powerpoint Templates

SCREEN OUTPUT AND ESCAPE SEQUENCEprintf(“samahan mo \\akong\\ pa-blood\n”);

printf(“test… \n\nbaket???”);printf(“\t\npara malaman \nmo ikaw \tang \”type ko\””);

samahan mo_ _\ akong _\ _pa-blood__test…

___baket???_ _

_para malaman _

_mo ikaw _ _ang _“type ko_“_

_

Page 4: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS

FORMAT SPECIFIERS starts with a percent sign % followed by a character that specified the format type

printf(“ twenty five %d”, <argument list>)

FORMAT SPECIFIERS

%c a single character%s string of charcters%i or %d integer number%f floating point%% prints a percent sign

FORMAT SPECIFIER FORMAT TYPE

Page 5: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS

FORMAT SPECIFIER %cprintf(“charcater %c\n”, ‘a’);

printf(“character %c”, ‘5’);

FORMAT SPECIFIER FORMAT TYPEARGUMENT LIST

_character _a__character _5_

Page 6: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS

FORMAT SPECIFIER %sprintf(“string is %s\n”, ”SUPERman” );FORMAT SPECIFIER FORMAT TYPE ARGUMENT LIST

_string is_SUPERman__

Page 7: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS

FORMAT SPECIFIER %i or %dprintf(“integer %i\n”, 5);

printf(“integer %d”, 25);

FORMAT SPECIFIER FORMAT TYPEARGUMENT LIST

_integer _5__integer _25_

Page 8: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS

FORMAT SPECIFIER %fprintf(“float %f\n”, 5.3);

printf(“float with two decimal places %.2f”, 5.345 );

FORMAT SPECIFIER FORMAT TYPEARGUMENT LIST

_float _5.300000__float with two decimal places _5.35_

NUMBER OF DECIMAL

Page 9: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS

FORMAT SPECIFIER %%printf(“Printing percent %%\n”);FORMAT SPECIFIER FORMAT TYPE

_Printing percent _%__

Page 10: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS<argument list> contains exactly the same number of arguments as there are format specifiers, and the format specifiers and argument list are matched in order

printf(“Product of 5 and 25 is %i\n”,5 * 25);printf(“Product of %d and %d is %i”, 5, 25, 5 * 25);

_Product of 5 and 25 is

_125

_

_Product of _5 _and _25 _is _125_

Page 11: Quiz01 and format specifier

Free Powerpoint Templates

FORMAT SPECIFIERS

If the item of data type that does not directly correspond to the format specification, you will get unpredictable result

printf(“integer %f”, 2);

Abnormal program termination

printf(“My name is %d”, ”ARVIN”);

_My name is _419_