Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Explain the following C++ code line by line using comments. Dont use screentshot i need to be able to edit the comment. #include using namespace

Explain the following C++ code line by line using comments. Dont use screentshot i need to be able to edit the comment. #include using namespace std; int main(void) { printf(" LAB_No_06_Extending_Signed_and_Unsigned_Numbers "); // Lab number and lab name here printf(" Module: Embedding and in-line assembly language module into a C program "); printf(" James Rodriguez, ID#12345678 "); // Student's name here printf(" CET3510-E205 "); // Student's Class here printf(" Submission date: January 20, 2019 "); // Date of the Student's program when submitted here printf(" Due date: January 28, 2019 "); // Date of the Student's program due date printf(" Example 6.21 extendingNumTemp.cpp "); // Student's file name for the program here printf(" File name: extendingNumTemp.cpp "); // Student's file name for the program here printf("----------------------------------------- "); unsigned char us8 = 0xfd; signed char s8 = 0xfd; unsigned int us32; signed int s32; //A 8-bit unsigned number extended to a 16-bit unsigned number. printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); printf("An 8-bit unsigned number extending to a 32-bit unsigned number "); printf("unsigned hexadecimal value is 0x%x ", us8); printf("its associated unsigned deciaml value is %u ", us8); _asm { MOV AH, us8; MOVZX EAX, AX; MOV us32, EAX; } cout << "After zero extension, "; cout << "the identical hex value with 32-bit unsigned number is " << hex << us32 << ' '; cout << "and its associated decimal is " << dec << us32 << ' '; //A 8-bit signed number extended to a 16-bit signed number. printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); printf("An 8-bit signed number extending to a 32-bit signed number "); printf("signed hexadecimal value is 0x%x ", us8); printf("its associated signed deciaml value is %d ", us8); _asm { MOV BH, s8; MOVSX EBX, BX; MOV s32, EBX; } cout << "After sign extension, "; cout << "the identical hex value with 32-bit signed number is " << hex << s32 << ' '; cout << "and its associated decimal is " << dec << s32 << ' '; system("pause"); exit(0); return 0; }

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

Step: 3

blur-text-image

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

Revenue at 5 0 0 units ? refer image

Answered: 1 week ago