can anyone make this programme into object oriented

#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string>
using namespace std;

//declare variables and functions
int rand_0toN1(int q); //generates a random number up to last_card_position
void swap_to_last(); //moves the selected card to the last selected position and decreazses last_card position
void shuffle_the_deck(); //randomizes the deck order
void make_deck(); //makes the deck in order
void display_the_deck(); //displays the deck for debugging
int last_card_position = 52; //holds position of the last card in the array still valid for drawing
char*suits[4] = {"heart","Spade","diamond","Club"};
char *ranks[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
struct build_deck { // define the deck structure
char *suit;
char *rank;
};
build_deck deck[53]; //holds the deck we make
//53 is for shuffling to swap cards
int main()
{
int i, n;
srand(time(NULL)); // seeds the random number with current time
// make the deck
cout << "Making the deck" << endl; // for debugging
make_deck(); // build a deck of 52 cards
cout << endl;
while(1)
{
cout << "Shuffling the deck..." << endl;
shuffle_the_deck();
cout << "Enter no. of cards to deal (0 to exit): ";
cin >> n;
if (cin.fail()) break;
// test for valid entries

// but this does not capture decimals or letters. Need to add that feature.

while ( (n>52) || (n<0) )
{
cout << endl << endl << "WARNING: Number must be between 1 and 52!";
cout << endl << "Enter no. of cards to deal (0 to exit): ";
cin >> n;

if (cin.fail()) break;

}

if (n == 0) break;



// display the dealt cards

for (i = 0; i < n; i++) {
cout << deck[i].rank << "" << deck[i].suit << endl;

}

cout << endl << endl;

cout << "Cards have been dealt." << endl << endl;



}

return 0;

}





// Make the Deck

void make_deck() {

int s, r, c; //s for suit, r for rank, c for cards

c = 0; {

for (s=0; s<4; s++) {

for (r=0; r<13; r++) {

deck[c].rank = ranks[r];

deck[c].suit = suits[s];

c++;

}

}

}

}



// display the deck -- used for debugging

void display_the_deck() {

int display_card;

for (display_card=0; display_card<52; display_card++)

cout << display_card+1 << ". " << deck[display_card].rank << " of " << deck[display_card].suit << " | ";

cout << endl;

}





// Random 0-to-N1 Function

// Generates a random integer from 0 to N-1

int rand_0toN1(int q) {

return rand() % q;

}





// Shuffle the cards

void shuffle_the_deck() {

int card_num;

int card_num2;

int i;



for (i=0; i<1000; i++) {

//randomly get the card_num position

card_num = rand_0toN1(52);

card_num2 = rand_0toN1(52);


deck[53].rank = deck[card_num].rank;

deck[53].suit = deck[card_num].suit;



deck[card_num].rank = deck[card_num2].rank;

deck[card_num].suit = deck[card_num2].suit;



deck[card_num2].rank = deck[53].rank;

deck[card_num2].suit = deck[53].suit;

}
}

You using C and C++ together, this is bad. If you wanna use oriented object in your program, use C++. But, first estudy the basics of the language.
closed account (3pj6b7Xj)
I love hybrid programs, lol.
can any pro C++ programmer add me MSN pusonghui@hotmail.com i got so much question to ask. Thanks a lot.
what does object oriented mean?
try here:

http://www.i-cannot-be-bothered-to-do-my-homework.com
Topic archived. No new replies allowed.