|
From: Amit K. S. <ams...@qu...> - 2004-06-11 03:33:36
|
First remove the ; after the if statements.
You are not providing the parameter in declaration of these functions randn
and blines as you give in the defination.
See the changes in red color
make these changes if also you find some problem reply me.
-amit
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Randy
Sent: Friday, June 11, 2004 7:53 AM
To: dev...@li...
Subject: [Dev-C++] Help whats wrong?
Help whats wrong?
#include <stdio.h>
#include <stdlib.h>
void showone();
void showtwo();
void showthree();
void showfour();
void showfive();
void showsix();
int randn( int );
char getans( );
void blines( int );
void main ()
{
int r;
char ans;
ans=getans();
while(ans=='y')
{
r=randn(6);
blines(25);
if(r==1); showone(); // Remove the ; after these if blocks
if(r==2); showtwo();
if(r==3); showthree();
if(r==4); showfour();
if(r==5); showfive();
if(r==6); showsix();
blines(21);
ans=getans();
}
blines(2);
}
int randn(int n)
{
return rand()%n + 1;
}
char getans()
{
int ans;
printf("Throw y/n ?");
ans = -1;
while (ans == -1)
{
ans=getchar();
}
return ans;
}
void blines(int n)
{
int i;
for( i=1 ;i<=n ; i++) printf("\n");
}
void showone()
{
printf("\n * \n");
}
void showtwo()
{
printf(" * \n\n");
printf(" * \n");
}
void showthree()
{
printf(" * \n");
printf(" * \n");
printf(" *\n");
}
void showfour()
{
printf(" * * \n\n");
printf(" * * \n");
}
void showfive()
{
printf(" * * \n");
printf(" * \n");
printf(" * * \n");
}
void showsix()
{
int i;
for(i=1 ; i>=3 ; i++) printf(" * * \n");
}
|