The wonderful use of two well numbers in VC

Source: Internet
Author: User
There is a text () macro in VC, And the execution status is as follows:
    1. Text ("ABC")// The result is l "ABC"
    2. Text (XYZ)// The result is lxyz.

This is defined in the header file.

    1. # DEFINE _ text (quote) _ text # quote

What are the roles of these two well numbers? By viewing msdn, we found that they are used to link the strings inside and outside brackets.
This feature can solve the current small problems
For exampleProgramThe engineer is responsible for writing a program module. His head asks him to add a prefix before each variable name to identify which module is defined, the prefix he obtained is "company _ big department _ small department _ big group _ Three _". If each variable is prefixed with such a long prefix, it will be too difficult to write, second, it is also prone to errors, and the variable name is not like a string, so you can split and combine it at will. at this time, we can use two well numbers to easily solve the problem.
CodeAs follows:

  1. # Include <iostream>
  2. UsingSpacename STD;
  3. # Define z (nvar) company _ big departments _ Small departments _ big group _ zhangsan _ # nvar
  4. VoidMain ()
  5. {
  6. // Int company _ big department _ small department _ big group _ Zhang san_1 = 10;
  7. IntZ (1) = 10;
  8. IntZ (2) = 20;
  9. IntZ (3) = 30;
  10. // Int max = z (1) + company _ big departments _ Small departments _ big group _ Michael _ 2 + z (3 );
  11. IntMax = z (1) + z (2) + z (3 );
  12. Cout <max <Endl;
  13. }

The code is implemented in WINXP and vc2005.

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.