"C + + institute" 0725-memory complement analysis/complement original code Combat/print integer binary data/Static library description

Source: Internet
Author: User

"To the programmer on the road."

For a developer, the ability to develop any module in a system is the embodiment of its core value.

For an architect, mastering the advantages of various languages and applying them to the system simplifies the development of the system and is the first step in its architectural career.

For a development team, in the short term to develop a user satisfaction of the software system is the core competitiveness of the embodiment.

Every programmer can not be complacent, to contact the new industry, new technology field, break through the ego.

Memory Complement Analysis
#include <stdio.h> #include <stdlib.h>void main3 () {//printf does not perform data type conversion printf ("%d", (int) 10.3);// printf no matter what type you are, follow%d,%f parse data printf ("\n%f", (float) ten); GetChar ();} void  main4 () {int num = 100;printf ("%p", &num);//different interpretations have different interpretations of the result GetChar ();} void   Main5 () {char ch = 1,ch1= ' 1 ';//The difference between the character and the number printf ("%d,%d", Ch,ch1); GetChar ();} void   main6 () {//parsing, the length of the data is related unsigned short num = 65535+1;printf ("Liu Ningbo has%d Yuan", num);//  99//100getchar ();} void   main7 () {//complement, the way the computer stores data short num = -1;printf ("%d", num);p rintf ("\n%u", num);//%u 0-positive integer getchar ();}
Complement the original code combat
#include <stdio.h> #include <stdlib.h> #include <limits.h>void main10 () {int x = 1;int y = -1;//complement printf ( "X=%p,y=%p", &x, &y); System ("Pause");} void main123 () {//int unsigned int 4 bytes 32 bits//signed, 0 for positive, 1 for negative//0111 1111 1111 1111 1111 1111 1111 1111//1111 1111 1111 111 1 1111 1111 1111 1111//unsigned, positive, all data printf ("%d,%d", Int_max, int_min);//%d can only display int_min->int_maxprintf ("\n%d,%d", Int_max+1, int_min-1);p rintf ("\n%u,%u", Uint_max, 0);p rintf ("\n%u,%u", uint_max+1, 0-1);//%u 0->uint_maxsystem (" Pause ");} void main1234 () {int x = 4294967295;int y = -1;//1111 1111 1111 1111 1111 1111 1111 1111 How memory is stored//unsigned, unsigned bit, all data 429496729  5//0000 0000 0000 0000 0000 0000 0000 0001 1 Original code//1000 0000 0000 0000 0000 0000 0000 0001-1 Original Code//1111 1111 1111 1111 1111 1111 1111 1110-1 Anti-code//1111 1111 1111 1111 1111 1111 1111 1111-1 of the complement of printf ("%d,%u", x,x);p rintf ("\n%d,%u", y, y); GetChar ( );} void Main () {unsigned int num = -1;////1111 1111 1111 1111 1111 1111 1111 1111 Memory storage mode printf ("%d,%u", NUM, num); system ("Pause");} 

Printing integer binary data
#define  _crt_secure_no_warnings#include<stdio.h> #include <stdlib.h>void main1 () {int num;scanf ("%d ", &num);p rintf (" num=%d,&num=%p\n ", num,&num); int data  = 1 << 31;//Constructs a phase-to (int i = 1; I <= 32; i++) {int temp = num&data;//to find the first and if (temp = = 0) {Putchar (' 0 ');} Else{putchar (' 1 ');} Num <<= 1;if (i% 4 = = 0) {printf ("");}} System ("Pause");} void Main () {int num;scanf ("%d", &num);p rintf ("num=%d,&num=%p\n", num, &num); int  data = 1 << 31;// Build a phase data if (num < 0) {num = ~num + 1;//code   num = num | data;//set symbol bit   }for (int i = 1; i <=; i++) {int temp = num&data;//the first and if (temp = = 0) {Putchar (' 0 ');} Else{putchar (' 1 ');} Num <<= 1;if (i% 4 = = 0) {printf ("");}} System ("Pause");}

Static Library description

1. Attribute add Xxx.lib link or code way implementation #pragma comment (lib, "Detours.lib")

2. And put the xxx.lib in the source directory


|=========== Wu Yingjiang csdn Blog Column ==============|

|== the content of the A/C + + College column (not updated regularly) ===|

|== Linux-Driven development explores the secrets of Linux's underlying ==========|

|== basic knowledge of Java Basic Learning =====|

| ====== Daily Progress a little, healthy and happy every day ========|




Copyright NOTICE: Welcome reprint, Hope in your reprint at the same time, add the original address, thank you for your cooperation!

"C + + institute" 0725-memory complement analysis/complement original code Combat/print integer binary data/Static library description

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.