Softlookup.com ( tutorial)

 

Declaration

<script language="javascript">

 

Function call

function delCookie(NameOfCookie)
{
if(getCookie(NameOfCookie)){
document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

 

Array

int main()
     {
        int myArray[5];
        int i;
        for ( i=0; i<5; i++)  // 0-4
        {
           cout << "Value for myArray[" << i << "]: ";
          cin >> myArray[i];
       }
       for (i = 0; i<5; i++)
          cout << i << ": " << myArray[i] << "\n";
     return 0;
 }

Output:

Value for myArray[0]:  3
Value for myArray[1]:  6
Value for myArray[2]:  9
Value for myArray[3]:  12
Value for myArray[4]:  15
 

0: 3
1: 6
2: 9
3: 12
4: 15
 

 

If Statement

 if (!itsNext)
            itsNext = newNode;
         else
         {
            int NextCatsAge = itsNext->GetCat()->GetAge();
            int NewAge =  newNode->GetCat()->GetAge();
            int ThisNodeAge = itsCat->GetAge();

            if (  NewAge >= ThisNodeAge && NewAge < NextCatsAge  )
            {
               newNode->SetNext(itsNext);
               itsNext = newNode;
            }
            else
               itsNext->Insert(newNode);
         }
       }
 

 

Loop

 for (i = 0; i<3; i++)
       {
          cout << "sentinelOne[" << i << "]: ";
          cout << sentinelOne[i] << "\n";

          cout << "sentinelTwo[" << i << "]: ";
          cout << sentinelTwo[i]<< "\n";
       }
 

Class

 class CAT
     {
        public:
           CAT() { itsAge = 1; itsWeight=5; }
          ~CAT() {}       
          int GetAge() const { return itsAge; }
          int GetWeight() const { return itsWeight; }
          void SetAge(int age) { itsAge = age; }

       private:
          int itsAge;
          int itsWeight;
       };

   int main()
    {
       CAT Litter[5];
      int i;
      for (i = 0; i < 5; i++)
          Litter[i].SetAge(2*i +1);

       for (i = 0; i < 5; i++)
       {
          cout << "Cat #" << i+1<< ": ";
          cout << Litter[i].GetAge() << endl;
       }
     return 0;
 }
 

 

Out put

cat #1: 1
cat #2: 3
cat #3: 5
cat #4: 7
cat #5: 9
 

 

 

<<Next>>

Hosted by www.Geocities.ws

1