Thursday, August 5, 2010

High-quality C + + / C Programming Guide - Chapter 5 constant


Chapter 5 constant
Constant is an identifier, its value is constant during operation. C language defined using # define constants (called macro constant). C + + language in addition to # define const outside can also be used to define the constants (known as constants const).

5.1 Why do we need constant
If you do not use constants directly in the program fill in numeric or string, there will be any trouble?

(1) readability (intelligibility) worse. The programmer to forget what the numbers mean, or string, the user is more I do not know where they come from, that what.

(2) in many parts of the program enter the same number or a string, be sure to write the error does not occur.

(3) If you want to modify the number or string will be changed in many places, cumbersome and prone to error.


Rule 5-1-1銆?銆恗ake full use of the constant for the intuitive meaning of those who will appear many times in the program number or string.

For example:

# DefineMAX100 / * C language macro constants * /

constintMAX = 100; / / C + + language, the constant const

constfloatPI = 3.14159; / / C + + language, the constant const

5.2const comparison with the # define
C + + language you can use const to define the constants can also be defined using # define constants. But the former than the latter have more advantages:

(1) const constant with data types, but there is no macro data type constant. Compiler can be carried out on the former type of security check. While the latter only for character replacement, there is no type of security check, and replace characters may produce unexpected errors (marginal effects).

(2) Some integrated debugging tools for debugging on the const constant, but can not debug the macro constants.


5-2-1銆?銆恟ules in C + + program to use only const constant constants instead of macros, or completely replace the macro const constant constants.

5.3 Constants defined rules
5-3-1銆?銆恟ules open to the public's constant need to put a header file, do not open to the public of the constants in the definition file in the head. For management purposes, different modules can be stored in a constant concentration of public header file.

Rule 5-3-2銆?銆怚f a constant with other constants are closely related, should be included in the definition of this relationship, and not give some isolated values.

For example:

constfloatRADIUS = 100;

constfloatDIAMETER = RADIUS * 2;

5.4 class constants
Sometimes we hope that some of the constants is only valid in the class. Because # define macros defined constants are global and can not achieve their goals, so take it for granted that modify const data members should be achieved. const data member is indeed exists, but its meaning is not what we expect. const data members only during the lifetime of an object is constant, but in terms of the whole class is variable, because the class can create multiple objects, different object const data member whose value can be different.

In the class declaration can not initialize const data members. The following usage is wrong because the class object is not created, the compiler does not know what the value of SIZE.

classA

(...

constintSIZE = 100; / / error, attempt to initialize the const declaration in the class data members

intarray [SIZE]; / / error, unknown SIZE

);



const data member initialization can only be in the class constructor initializes the table, for example

classA

(...

A (intsize); / / Constructor

constintSIZE;

);

A:: A (intsize): SIZE (size) / / constructor initialization list

(

...

)

Aa (100); / / object a, SIZE value of 100

Ab (200); / / object b of the SIZE value of 200



How can we build in the entire class are a constant constant it? Do not expect const data members, and should use class enumeration constants to achieve. Such as

classA

(...

enum (SIZE1 = 100, SIZE2 = 200); / / enumeration constant

intarray1 [SIZE1];

intarray2 [SIZE2];

);

Enumeration constants will not take up storage space object, they are all evaluated at compile time. Enumeration constant drawback is: it's implicit data type is an integer, its maximum value is limited, and can not be said that floating-point (such as PI = 3.14159).






相关链接:



Neat old photographs - photo repair With Image Doctor



download converter Mp4 to 3gp



"Tencent Night Awards" announced this year's Great Wall Advertising Festival award the fifteenth



Contact HOME Linkist then the new tactics: to provide professional exhibition space



convert vob to flv



Dan Zhongshao: I want to lead by two years



windows 7 rmvb



My favorite Food And Drink



Production of fine wood decorative painting



Astrology Or Biorhythms Or Mystic Expert



WHAT dealers need to support?



FTP Site Preferences



Cable CONSTRUCTION should focus on good single-disc test



ts file EXTENSION



Thursday, July 15, 2010

Multimedia effect is good, but not indiscriminate



S-jun is to teach law at a university, a young teacher, preparing lessons seriously because of his thick foundation coupled with professional, so popular with college students teach. But now it is one thing but plagued with: that the department requires that all courses have to produce multimedia courseware, or not to the podium. S Jun grumbled, said: "multimedia courseware is not difficult for me. But I personally think that some courses may not apply to such means. For example, I teach the contents of the large number of legal provisions need to be addressed, I do have to collect this a large number of fresh cases and the results can be interpreted very clear about the effect the production of courseware is hard to say. "
Words fall caused the author's some thought.

Now in college, making a growing tendency to Multimedia class, the university's courseware competition are well underway. This is undoubtedly the use of modern technology to promote university education means, the use of sound, light, maps, text and other information elements to stimulate the brain and then teach the students new knowledge is beneficial.

But many universities have been "cut" to require all courses to use multimedia teaching and radical rejection of traditional teaching methods. After some investigation, I think this is wrong. Reasons summarized as follows

First, the use of multimedia courseware in a variety of visual, auditory, profile undoubtedly has its excellent irreplaceable, but because of its speed and can operate in kaleidoscope, in some areas there is a kind of foggy for changing course unpredictable feel. Particularly the relatively weak basis for some students, since its about time seems too short and flip so much less time for students to take notes, so rational and systematic in the article are more a lack of respect.

Second, because teachers need to continue to operate a computer about, and therefore the interaction with the student's communication is not sufficient. Needless to say, school teachers, in large part requires constant interaction and communication with students. Many experienced senior teachers is fine for each observation of students master the knowledge behind the knowledge of its true condition. And this interaction is essential for every teacher.

Third, the use of some large amount of text or numbers of courses, such as law, mathematics, its content was doomed to be the use of concepts, judgments, logic and reasoning to express, if also solely emphasizing the use of courseware to teach the times it becomes a matter The power half, the effect probably will not very good.

In summary, although the university on behalf of teaching with multimedia courseware for higher education in modern high-tech fashion trend, but in practical application, but also on the spirit of "seeking truth from facts" approach, according to local conditions, because of course the system should, the people desirable, but not indiscriminate, but should not be rude to "cut" in order to better achieve traditional teaching methods and the complementary advantages of modern technology, and then complement each other.







Recommand Link:



WorldCup Youtube Converter



mkv files



Convert mp3 to m4a



2008 Zhongguancun Top Ten News: Premier Wen inspected Zhongguancun selected



Psp 6000



Hope SVCD Convert



Articles about Graphic



ARTICLES about Audio Speech



Happiness DVD 3GPP to RM



WondSoft Video Converter



Haobo POS Invoicing Special 1388 yuan / USER



Picked Recreation



Easy Graphic



Mp3 to aac converter



RA Music to CD



Ever CD-R WMA AAC To APE Copy



Professional CD ID3 M4A to AMR Player



Saturday, July 10, 2010

Swift DVD to MPEG4 ASF MPEG

Swift DVD to MPEG4 ASF MPEG - A fast DVD to MPEG4 ASF MPEG converter which can convert and burn AVI, MPG, MPEG 1/2/4, WMV, MOV, MP4, RM, RMVB, DivX, Xvid, ASF, 3GP, Youtube FLV to DVD VOB VCD SVCD easily. With this DVD VCD SVCD converter, you will know how to make a DVD video. You can use it to convert and burn DivX, Xvid, AVI, MPG, MPEG 1/2/4, WMV, MOV, MP4, RM, RMVB files to DVD with chapter Menu. With that, you can convert downloaded videos and burn files into DVD, which means Internet become the storehouse of your home theater! Get Free download now!



Swift DVD to MPEG4 ASF MPEG - What a powerful and attractive AVI, MPG, MPEG 1/2/4, WMV, MOV, MP4, RM, RMVB, DivX, Xvid, ASF, 3GP, Youtube FLV to VOB converter. This software can burn DivX to DVD and convert DivX to VOB and finish all your tasks with the fastest speed possible and the best quality available. No one will ask how to make a DVD video anymore once they try this great DivX to VOB converter. We highly recommend this program because we think it will make your multimedia life a lot easier and more enjoyable. It allows you to specify NTSC or PAL format, adjust 4:3 or 16:9 video aspect, and burn either DVD disc or ISO file. By setting bitrate and framerate, you can get excellent quality on TV screen. Just free download and enjoy it right now!



Recommand Link:



Free FLV Watermarker



Yaease Flash to Video Studio



Flv to mpeg converter free



Swf to flv



Basic Or VB Or VB DotNet Catalogs



Ever DVD-Audio AMR CD-R to ID3 Backup



avi To iphone



convert MOV to flv



Constansoft Real Video Converter



Youtube Movie To QuickTime Suite



Wondershare Video to DVD Burner



Genealogy reviews



Vacations MP4 Converter



Youtube FLV to Divx Plus



Vertical Market Apps Shop



Monday, July 5, 2010

Power CD+G to Video Karaoke Converter

Convert CD+G discs and files to AVI and MPEG karaoke videos. Play karaoke songs on your computer, DVD players, or DivX-compatible portable devices. Power CD+G to Video Karaoke Converter allows you to convert CD+G discs to karaoke videos, convert CDG/BIN/MP3+G files from your hard disc to karaoke videos, use AVI (DivX) or MPEG formats, and use batch mode to convert many files at once.

Power CD+G to Video Karaoke Converter can be used in two modes: direct CD+G disc converting mode (this mode allows to read the content of CD+G disc and convert it to videos; works with almost any CD+G drive, and freeDB online CD+G disc database is used to provide song titles), and files from hard disc converting mode (using this mode you may convert BIN or MP3+G files from your hard disc -- BIN, CDG, and MP3+G formats are supported, batch processing allows to process many files without user intervention).

You may use two file formats: AVI files can be used to play on your computer, DivX-compatible DVD players, or DivX-compatible portable devices. MPEG files can be used to create VideoCD or DVD discs to play on regular DVD players or play on Macintosh and other computers that do not support AVI.



Recommand Link:



Pavtube Video to Apple TV Converter



youtube to Mp4



Top Personal Finance



Flv to 3gp converter



Happiness Divx RM to AVI



Wondershare DVD Ripper Platinum



Merry CD CDA WAVE to AMR Recorder



iUoysoft PSP Movie/Video CONVERTER



INVENTORY And Barcoding introduction



LasVegas DVD Manager



Mp4 To Wmv Converter Free



DVDSmith Movie Backup



Comparison Browsers



Apple MPEG 3GPP Google Video Conversion



AlltoDVD DVD to Blackberry



Avi to ipod



Thursday, June 24, 2010

Bluesea Flash Converter



Bluesea Flash Converter is a All-in-One powerful tool. Convert all popular video and audio formats, swf or flv to video, such as avi, mpeg, 3gp, mp4, mov, it offers the solutions to problems that many other flash to video converting tools cannot solve, such as video and audio asynchronization, loss of frames, audio distortion, the process of alpha channel, and the process of both internal and external Flash video(flv). With the leading audio and video codec, Bluesea Flash Converter lets you easily and fully enjoy the original effects of your Flash files on your PC, iPod, PSP, Zune, iPhone, DVD players and other portable devices. In conclusion, with easy-to-use interface, fast converting speed, powerful functions.



Recommand Link:



DVDPean VIDEO



Good-OK Video Converter Gold



Evaluate Graphic Viewers



Download HD To Sony NWZ-E444 Soft



X-Cloner Flash to PSP



Lohan RMVB Converter



comments HTML Tools



Christmas-Idea MPG Converter



easily and FASTLY rip and convert dvd and video



CDA To MP3 Guide



News About Astronomy



Aoork DVD2AVI PRO



SuperBurner VOB To MPEG



Saturday, June 12, 2010

mp3Tag

Got a music collection with hundreds of poorly labeled mp3 files? Like having complete information about your music files - album, performer, genre, lyrics, year of release, and so on? Hate editing tags manually? We've got something you should take a look at!

ManiacTools mp3Tag 5 is a tag processor for MP3, WMA, OGG, APE, AAC, WAV, FLAC, WavPack WV, Musepack MPC/MPP/MP+ and Apple iPod MP4/M4a files with great features, like an automated search for lyrics and pictures (album covers). Another important advantage is the automatic tag filling option, which works great for mp3 albums that come without tags and meaningless file names, like 01.mp3, 02.mp3, 03.mp3, etc. The program takes the track lengths and compares this information with FreeDB data to find the appropriate album to import tags from. After confirmation the information is stored in the tags and if required can be used to rename the files. mp3Tag also import tags from Amazon.

ManiacTools mp3Tag 5 allows the users to view and edit tag information, save lyrics and pictures inside MP3/WMA/M4a files, view technical information about music files and delete unused MP3-tags. The program is capable of changing one or more tag fields simultaneously (including multiple files), generating Winamp and Windows Media Player playlists, exporting tag information, renaming groups of files according to their tag data and much more. And special feature for iPod lovers - m4a tag editor!

Other important program features are the Drag&Drop technology and is fully compatible with Windows Media Player 10 and iTunes 6. It does not require any special skills and has received over a dozen awards, including prestigious My Music Tools Editor's Pick. The program is translated into all major European languages.

The new version of the program is extremely fast, very stable, completely bug-free and is incredibly easy to use. Download ManiacTools mp3Tag 5 now and take it for a free 30 day test-run!

Wednesday, May 19, 2010

SuperBurner DVD Manager

SuperBurner DVD Manager is a easy-to-use and high speed All-in-One AVI, MPG, MPEG 1/2/4, WMV, MOV, MP4, RM, RMVB, DivX, Xvid, ASF, 3GP, Youtube FLV to DVD VOB manager. This software can burn video to DVD and convert video to VOB and finish all your tasks with the fastest speed possible and the best quality available. No one will ask how to make a DVD video anymore once they try this great video to VOB manager. We highly recommend this program because we think it will make your multimedia life a lot easier and more enjoyable. It allows you to specify NTSC or PAL format, adjust 4:3 or 16:9 video aspect, and burn either DVD disc or ISO file. By setting bitrate and framerate, you can get excellent quality on TV screen. Just free download and enjoy it right now! DVD Manager helps you not only to slide show your favorite photos on TV but also watch video files on your computer or on your TV.