The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d .
Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet.
Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1.
Definition
E:\Visual_C__MFC擴(kuò)展編程實(shí)例 例18
動態(tài)地抓取應(yīng)用程序的屏幕圖像并將其打印。
上一個(gè)實(shí)例打印的是文檔的報(bào)表,而不是當(dāng)前出現(xiàn)在屏幕上的內(nèi)容。在本例中,將實(shí)現(xiàn)
屏幕抓取并打印其內(nèi)容。M F C 為打印視提供了有限的支持, 但只要用M F C 在
C Vi e w : : O n D r a w ( )中所提供的設(shè)備環(huán)境,就可以繪制自己的視。在打印視的時(shí)候, M F C只需調(diào)
用具備打印機(jī)設(shè)備環(huán)境的O n D r a w ( )函數(shù)即可。但是,如果不繪制自己的視,例如,用一個(gè)或
者一個(gè)以上的控件窗口填充自己的視就不會打印任何東西。每個(gè)控件將使用自己的設(shè)備環(huán)境
將自己打印到屏幕,因此打印視的唯一途徑就是抓取屏幕(拷貝其內(nèi)容到一個(gè)位圖對象)并將其
打印到打印機(jī)。由于該功能整個(gè)與位圖相關(guān),因此將該功能封裝到了位圖類中。