problem:
five students pick five balls, but they must not choose the same ball
this program does not work
i dont know what is wrong.
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
int i;
int student[5] = {0};
int ball[6] = {0};
int choice;
for(i = 0; i < 5; i++)
{
printf("%d. student...which ball you choose? ",i + 1);
scanf("%d",&choice);
while(choice <= 0 || choice > 5){
printf("enter number between 1-5 ");
scanf("%d",&choice);
}
if(ball[choice] != 0)
{
do{
printf("re enter ");
scanf("%d",&choice);
while(choice <= 0 || choice > 5){
printf("enter number 1-5 ");
scanf("%d",&choice);
}
}
student[i] = choice;
}
for(i = 1;i <= 5; i++)
{
printf("%d. student chosen ball %d number.\n",i,student[i - 1]);
}
system("PAUSE");
return EXIT_SUCCESS;
}