Esempio n. 1
1
void Learn::test4() {
    int wallet1 = 300;
    int wallet2 = 350;
    cout << "wallet1 = $" << wallet1<<endl;
    cout << "wallet2 = $" << wallet2<<endl;

    swapr(wallet1,wallet2);
    cout << "wallet1 = $" << wallet1<<endl;
    cout << "wallet2 = $" << wallet2<<endl;

    swapp(&wallet1, &wallet2);
    cout << "wallet1 = $" << wallet1<<endl;
    cout << "wallet2 = $" << wallet2<<endl;

    swapv(wallet1,wallet2);
    cout << "wallet1 = $" << wallet1<<endl;
    cout << "wallet2 = $" << wallet2<<endl;

}
Esempio n. 2
0
void Selection(int *a,int num)
{
          int pass=0;
          int loc;
          while(pass<num-1)                                      // N-1 passes in Selection Sort
          {
               loc = Min(a,num,pass);               
               swapv((a+pass),(a+loc));                                 
               pass++;                                                                                                     
          }     
}