Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSCI 311 Project 2 Individual Assignment Due: February 5, 2018 Points: 15 Purpose: The objective of this oject is to gain experience with C language

image text in transcribed
CSCI 311 Project 2 Individual Assignment Due: February 5, 2018 Points: 15 Purpose: The objective of this oject is to gain experience with C language pre- processor directives and bit-wise operators. Requirements: The assignment centers around an integer whose digits are to be reversed. The interpretation of what is a digit is to be based on whether a compile-time option specifies that binary or hexadecimal digits are to be used. Whenever possible you must make use of bit-wise operators (not arithmetic operators). 1. This assignment is an individual assignment: You are expected to produce your 2. header file: In addition to a c file, also write and use a header (h) file. Include 3. main routine: The main routine is to be structured as follows: own solution to the assignment. in this header file your #define statements and other appropriate items. set number based on compile-time selection (see item 4.c below). for each digit in the number: extract digit from number display original number and reversed number in binary or hexadecimal; perform another reversal of the reversed number and verify that the second insert into reversed number see item 4.d below. number matches the original number Except for perhaps a function to display numbers to a specified base, main is not to use functions that you write, but must use macros as explained below. You must write and use several macros to accomplish this project; Write one macro to extract a digit from the number. This macro must work for both binary digits and hexadecimal digits. Write one macro to insert a digit into the reversed number. This macro must work for both binary digits and hexadecimal digits. Use a #define to specify the selected number. It must be possible to select one of the following three numbers without editing the program or inputting values into the program at runtime. The three numbers are: 4. macros: a. b. c. Use the -D option on the co-command to specify whether digits are to be base 2 or base 16; the default is base 16. This option also specifies 0x13579BDF, -65536, and 100. d. Spring 2018 CSCI 311 CSCI 311 Project 2 Individual Assignment Due: February 5, 2018 Points: 15 Purpose: The objective of this oject is to gain experience with C language pre- processor directives and bit-wise operators. Requirements: The assignment centers around an integer whose digits are to be reversed. The interpretation of what is a digit is to be based on whether a compile-time option specifies that binary or hexadecimal digits are to be used. Whenever possible you must make use of bit-wise operators (not arithmetic operators). 1. This assignment is an individual assignment: You are expected to produce your 2. header file: In addition to a c file, also write and use a header (h) file. Include 3. main routine: The main routine is to be structured as follows: own solution to the assignment. in this header file your #define statements and other appropriate items. set number based on compile-time selection (see item 4.c below). for each digit in the number: extract digit from number display original number and reversed number in binary or hexadecimal; perform another reversal of the reversed number and verify that the second insert into reversed number see item 4.d below. number matches the original number Except for perhaps a function to display numbers to a specified base, main is not to use functions that you write, but must use macros as explained below. You must write and use several macros to accomplish this project; Write one macro to extract a digit from the number. This macro must work for both binary digits and hexadecimal digits. Write one macro to insert a digit into the reversed number. This macro must work for both binary digits and hexadecimal digits. Use a #define to specify the selected number. It must be possible to select one of the following three numbers without editing the program or inputting values into the program at runtime. The three numbers are: 4. macros: a. b. c. Use the -D option on the co-command to specify whether digits are to be base 2 or base 16; the default is base 16. This option also specifies 0x13579BDF, -65536, and 100. d. Spring 2018 CSCI 311

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

Students also viewed these Databases questions