Advertisement
7_2009-2012 OLE/ COM/ DCOM/ Active-X #219041

Active X Tray Icon

This code is an ActiveX that let you put any icon image on the System Tray. Just select the image and the tooltip at the Properties Sheet and execute the ColocarIcono procedure. That's all. (It's a new version of a previous project published here. Spanish Version)

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
Upload
//Chapter 4, Exercise 33 of "A Guide to Programming in C++"
//(c)Morgan L.D.
//November 18, 2002
//Created with Dev C++ Programmer
//*Note* - Include files may vary among programmers
//This is a card game similar to Twenty-One
//
#include <iostream.h>
#include <stdlib.h>
#include <lvp\conio.h>
#include <lvp\random.h>
void main()
{
   randomize();
   cout<<"--Twenty-One Card Gamer--"<<endl<<endl;
   int CardsComp=3, ScoreComp=0, ScoreYou=0, Draw=0, CardsYou, Continue;
   int Cards1=0, YouTot=0, CompTot=0, Cards=0;
   const int TO=21;  //highest winning value
   while(1==1)  //runs loop until its broken
   {
     cout<<"How many cards do you want? ";
     cin>>CardsYou;
     cout<<"You: ";
     for(int CardsY=1; CardsY<=CardsYou; CardsY++)
       {
       Cards=random(10)+1;//generates random cards set to specific #
       cout<<Cards<<" ";
       YouTot+=Cards;  //totals cards
       }
     cout<<endl;
     cout<<"Computer: ";
     for(int CardsC=1; CardsC<=3; CardsC++)
       {
       Cards1=random(10)+1; //generates random cards
       cout<<Cards1<<" ";
       CompTot+=Cards1;  //totals cards
       }
     cout<<endl;
     cout<<"I have "<<CompTot<<" and you have "<<YouTot<<" so ";
     //below decides winning statement to output
     if(CompTot<=TO && CompTot>YouTot)
      { cout<<"I win"<<endl;
       ScoreComp++;
      }
     else if(YouTot<=TO && YouTot>CompTot)
      { cout<<"you win"<<endl;
       ScoreYou++;
      }
     else if(CompTot<=TO && YouTot>TO)
      { cout<<"I win"<<endl;
       ScoreComp++;
      }
     else if(YouTot<=TO && CompTot>TO)
      { cout<<"you win"<<endl;
       ScoreYou++;
      }
     else if(CompTot==YouTot)
      { cout<<"we draw"<<endl;
       Draw++;
      }
     CompTot=0;  //clears totals so they don't carry on in the...
     YouTot=0;       //next loop
     cout<<"Would you like to play again? (Y/N)? "; //loop program again
     Continue=getch();
     cout<<endl<<endl;
     if(Continue=='n' || Continue=='N')
      break;  //breaks loop if continue is true
   }
   cout<<"Computer wins = "<<ScoreComp<<endl;  //end of program
   cout<<"Your wins = "<<ScoreYou<<endl;      //chart
   cout<<"Draws = "<<Draw<<endl;
   cout<<endl;
   system("PAUSE");
}
Původní komentáře (3)
Obnoveno z Wayback Machine