Rithwik
2012-06-08 03:34:31 UTC
#include
#include
void main()
{
int value[100],val[1000];
char name[5][20],ch='y';
clrscr();
printf("\nEnter the 4 player names: ");
for(int i=1;i<=4;i++)
{
printf("\nPlayer[%d]: ",i);
scanf("%s",&name[i]);
}
while(ch=='y' || ch=='Y')
{
clrscr();
printf("\nEnter Scores: ");
for(int j=1;j<=4;j++)
{
printf("%s: ",name[j]);
scanf("%d",&value[j]);
}
for(int x=1;x<=4;x++)
{
val[x]+=value[x];
}
printf("\nDo you want to continue?(y/n): ");
scanf("%s",&ch);
}
clrscr();
printf("\n**********Score-Board************");
for(int y=1;y<=4;y++)
{
printf("\n%s: %d",name[y],val[y]);
}
getch();
}
The problem is that , while i am running this code, it works fine for the 1st time . But when i compile it for the second time, the SCORE BOARD displays the value after adding up the Previously compiled values . Please help me how to Remove the Previously stored values ( that adds up with the new values in the another Compilation of the same code ) I think the values are stored in Stack . but i am not sure abt it.