

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CSC 8400 Computer Organization 1 Workshop 1
CSC 7100 Computer Systems Summer 2007
Dr. Tom Way June 11, 2007
Due: June 18, 2007 Worth: 50 points
This workshop is designed to increase your understanding of data representation and basic input and output in a C program.
Description
You are to write a C program that prints an integer and a floating point value in different eight ways by re-interpreting it as the following data types or output formats:
You should compile and run your program with a variety of different values. Base your program on the example below.
Resources
What to hand in
Email me with the name of your program file and I will retrieve it from your account, compile it and run it. In the email provide a brief explanation of what you observed.
Grading criteria
Program compiles and runs 25 Accepts numeric input 5 Rejects non-numeric input 5 Prints output in 8 formats 5 Brief explanation of observations 10
CSC 8400 Computer Organization 2 Workshop 1
/------------------------------------------------------- Example program -------------------------------------------------------/
#include <stdio.h>
int main() { int int_value = 65; double float_value = -67.5; // Print int_value as various types // -------------------------------- printf("original int_value is %d\n", int_value); // as char // as hexadecimal // as scientific notation // as int // as unsigned int // long // as long long // as float printf("int_value as float: %f\n", int_value); // Print float_value as various types // ---------------------------------- printf("original float_value is %f\n", float_value); // as char // as hexadecimal // as scientific notation // as int printf("float_value as int: %d\n", float_value); // as unsigned int // long // as long long // as float }