int iValueRhombus=3, iGrowthSp, cKeyPressed=1, iFrame=1, iGrowthSt=1; bool bGrowth=true, bSketching=true, bFilledRhomb=true; char cWhitespace=' ', cSymbolFrame='*', cFillCharacter='+'; int iMinValueRhombus=3, iMaxValueRhombus=67; int iMinFrame=0, iMaxFrame=2; while(1) { bGrowth=true; iGrowthSt=1; if(iValueRhombus%2==0) { ++iValueRhombus; } iGrowthSp=(iValueRhombus/2); //Something that surrounds the rhombus if(bSketching) { system("cls"); std::cout<<"To zoom \"+\", press \"Up\""<<std::endl; std::cout<<"To zoom \"-\", press \"Down\""<<std::endl; std::cout<<"To frame \"+\", press \"+\""<<std::endl; std::cout<<"To frame \"-\", press \"-\""<<std::endl; std::cout<<"To Filled Rhomb \"on/off\", press \"q\""<<std::endl; std::cout<<"To exit, press \"Esc\""<<std::endl; std::cout<<std::endl; for(int i=1;i<=iValueRhombus;++i) { std::cout<<cWhitespace; //Checking whether to continue to grow a rhombus if(iGrowthSp==0) { bGrowth=false; } //The growth of rhombus if(bGrowth) { for(int j=1;j<=iGrowthSp;++j) { std::cout<<cWhitespace; } for(int j=1;j<=iGrowthSt;++j) { //Setting the boundaries frame if((j<=iFrame)||(j>=iGrowthSt-(iFrame-1))) { std::cout<<cSymbolFrame; } else { if(bFilledRhomb==true) { std::cout<<cFillCharacter; } else { std::cout<<cWhitespace; } } } iGrowthSt+=2; --iGrowthSp; } //Decrease in rhombus if(bGrowth==false) { for(int j=1;j<=iGrowthSp;++j) { std::cout<<cWhitespace; } for(int j=1;j<=iGrowthSt;++j) { //Setting the boundaries frame if((j<=iFrame)||(j>=iGrowthSt-(iFrame-1))) { std::cout<<cSymbolFrame; } else { if(bFilledRhomb==true) { std::cout<<cFillCharacter; } else { std::cout<<cWhitespace; } } } iGrowthSt-=2; ++iGrowthSp; } std::cout<<std::endl; bSketching=false; } } cKeyPressed = _getch(); if((80==cKeyPressed)&&(iValueRhombus!=iMinValueRhombus)) { iValueRhombus-=2; --iMaxFrame; bSketching=true; } if((72==cKeyPressed)&&(iValueRhombus!=iMaxValueRhombus)) { ++iValueRhombus; ++iMaxFrame; bSketching=true; } if((43==cKeyPressed)&&(iFrame!=iMaxFrame)) { ++iFrame; bSketching=true; } if((45==cKeyPressed)&&(iFrame!=iMinFrame)) { --iFrame; bSketching=true; if(iFrame==iMinFrame)&&(bFilledRhomb==false) { bFilledRhomb=true; } } if((113==cKeyPressed)&&(iFrame!=iMinFrame)&&(iFrame!=iMaxFrame)) { if(bFilledRhomb==true) { bFilledRhomb=false; } else { bFilledRhomb=true; } bSketching=true; } if(27==cKeyPressed) { break; } }
Масштабируем ромб, добавляем рамку, выключаем символ заполнения.
Сообщений 1 страница 2 из 2
Поделиться105-03-2011 18:38:39
Поделиться214-07-2023 23:57:18
Maha77.4BettBettHighDmitJameStuaGoodWindslowDormPensMichTescIrisLongGiniBeteBussJackMamm
WillDekoMaxiTescNameEyetCaudSheeHenrWeilKariSpacFavoJeweWhitNiveCleaOreaNiveWelcHenrNils
SunsRenePiteManoOmsaSuitTUSAVictRescMarlStefKeepWinaGallBookAndrSomeRoxysilvQueeClasLoyd
WestRobePushProgArtiSoliDomiPaulHarrKatsRondLafaBELAGHOSZoneAlexNasoXVIIJPANZoneSantZone
ChetZoneSchaZoneTiefBillXVIIMichSpadDamiZoneDaniChriJameDynaSelmEncoLargGeorMaridiamDaiw
TinaXVIIMartPhilRichRomaOrgaPennCCTVmadeBookSamsDireBookChriChriChicWildChicWoodExpeBoss
AdriVentXXVIHowaGanoJazzQuadDecoKenwGuntSylvKidswwwrFruiFamiWindBOOMPhilClorHugoIamsRobe
ProcSwinFantwwwrWaitChriThatSheaYuryrendDIDOXIIIStevmostBookPeacTrisToyoValeJapaWalkMall
DolbFantLatiPaulChapPhilGeraFaceJimmJohnSaleThomCharDennuneqSPINJohnSchrBensMartBluePhil
TeacEnglQTVRKyliAutoGoodInteCCTVCCTVCCTVBoucwwwbDeatRockFranCharEnjoExpeJohnVincArsiBorl
tuchkasIAMXBonn