The strings stack again and again. I dunno how to clear and reset it.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char performance [23] = "Performance: ", performance1 [10], rate [3] ="", rate1 [3], yesno;
int a;
do
{
printf("Enter value: ");
scanf(" %d", &a);
if (a >= 2000)
{
strcpy (performance1,"Excellent");
strncat (performance, performance1,9);
strcpy (rate1,"7%");
strncat (rate, rate1,3);
}
else if (a>= 1000)
{
strcpy (performance1,"Good");
strncat (performance, performance1,4);
strcpy (rate1,"5%");
strncat (rate, rate1,3);
}
else
{
strcpy (performance1,"Fair");
strncat (performance, performance1,4);
strcpy (rate1,"3%");
strncat (rate, rate1,3);
}
printf("%s\n", performance);
printf("%s\n", rate);
printf("Continue (Y/N)? ");
scanf(" %c",&yesno);
}while (yesno == 'Y' || yesno == 'y');
}