1. Random not working properly

Code:
```#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

int main()
{
int ch;
clrscr();
while(ch!='0')
{
puts ("Press the number of selection");
puts ("[1] Perfect Numbers");
puts ("[2] Fibonacci Numbers");
puts ("[3] Jack-En-Poy");
puts ("[0] EXIT\n\n");
while((ch=getch())!='0')
{

if(ch=='1')
{
int p,N[100] = {0},d,c,E=0;
printf("Input a number: ");
scanf("%d",&p);
for(d=1,c=0;d<p;d++)
{
if(p%d==0)
{
N[c]=d;
c++;
}
}
c=0;
while(N[c]!=0)
{
E=E+N[c];
c++;
}
printf("\n%d = 1",E);
c=1;
while(N[c]!=0)
{
printf(" + %d",N[c]);
c++;
}
if(p==E)
{
printf("\nPerfect!");
}
if(p!=E)
{
printf("\nDeficient!");
}
getch();
clrscr();
break;

}
if(ch=='2')
{
int c,N,N2,f,temp;
printf("Enter a Number: ");
scanf("%d",&f);
printf("0 1 ");
for(N=0,N2=1,c=1;c<=f;c=c+1)
{
if(c==(N+N2))
{
printf("%d ",c);

N=N2;
N2=c;
}

}
getch();
clrscr();
break;
}
if(ch=='3')
{
int AI;
char you;
printf("[S] scissors\n[P] Paper\n[R] Rock\nSelect your move:\n");
you=getchar();
AI=random(3);
if(AI==0)
{
printf("Computer:Scissors\n");
if(you=='S')
printf("DRAW!");
if(you=='P')
printf("LOSE!");
if(you=='R')
printf("WIN!");
}
if(AI==1)
{
printf("Computer:Paper\n");
if(you=='S')
printf("WIN!");
if(you=='P')
printf("DRAW!");
if(you=='R')
printf("LOSE!");
}
if(AI==2)
{
printf("Computer:Rock\n");
if(you=='S')
printf("LOSE!");
if(you=='P')
printf("WIN!");
if(you=='R')
printf("DRAW!");
}
AI=0;
getch();
clrscr();
break;
}

}
}

return 0;
}```
I have a problem in my Jack-En-Poy. At first it works but the second time around the program will pass around you=getchar() and will instantly prints the result without asking the user for the input.

2. Can you complie this?I got the error
Code:
`main.c:81: error: too many arguments to function `random'`

3. Code:
`you=getchar();`
Let's say the user enters an 'S' followed by 'enter' - the input buffer will contain:

Code:
`S\n`
The "getchar()" will take the 'S' but the newline will remain in the input buffer and get picked up by the next "getchar()", effectively bypassing it.

A quick solution would be to place a second "getchar()" after the first to eat up this newline:

Code:
```you=getchar();
getchar();```

4. Originally Posted by std10093
Can you complie this?I got the error
I got other errors myself, I'm guessing due to conflicting implementations of the "conio" header. But since these had no bearing on the question, I just bypassed (deleted or dummied) the problem functions to run the problem and verify my solution.

5. Originally Posted by Matticus
I got other errors myself, I'm guessing due to conflicting implementations of the "conio" header. But since these had no bearing on the question, I just bypassed (deleted or dummied) the problem functions to run the problem and verify my solution.
What had to do with conio.h i removed it before compiling.

6. Originally Posted by std10093
What had to do with conio.h i removed it before compiling.
I see. I made the assumption that the "random()" function was maybe part of the "conio" header, but I was mistaken. It appears to be part of the unix "stdlib" library (link). I tried the function in a simple program on a virtual machine running CentOS and it compiled and ran just fine.

7. random() is not working because it's being used incorrectly. random() takes no arguments.

Code:
`long int random(void);`
Use the same as rand(), example here. There may be other problems?

8. Originally Posted by fnprintf
random() is not working because it's being used incorrectly. random() takes no arguments.

Code:
`long int random(void);`
Use the same as rand(), example here. There may be other problems?
Yes that was the error.MAtticus a fprintf said,the error was "too many arguments in function random()"