Skip to content

Instantly share code, notes, and snippets.

@AungWinnHtut
Created November 5, 2017 09:27
Show Gist options
  • Save AungWinnHtut/04dea9394722e8d1723cf428b352f062 to your computer and use it in GitHub Desktop.
Save AungWinnHtut/04dea9394722e8d1723cf428b352f062 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
#include<iostream>
int cards[52];
int cards2[52];
int s=1;
using namespace std;
void funSortCards();
int main()
{
funSortCards();
//cutcards();
//sharecards();
_getch();
return 0;
}
void funSortCards()
{
time_t t;
srand((unsigned) time(&t));
int card;
int i;
int j;
int k;
for(i=0;i<52;i++)
{
do{
s=1;
card = (rand()%52)+1;
for(j=0;j<i;j++)
{
if(card==cards[j])
{
s=0;
}
}
}while(s!=1);
cards[i]=card;
}
for(i=0;i<52;i++)
{
cout<<cards[i]<<endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment