Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

These errors are from Mircosoft Visual studio.And need to be corrected to be com

ID: 3617280 • Letter: T

Question

These errors are from Mircosoft Visual studio.And need to be corrected to be compiled by Visualstudio.

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include<string.h>
int main()
{int personScore=0,computerScore=0,len,i,j,howmany;
char computer[4],person[4];
srand(time(0));
charchoices[10]={"hat","sox","dad","mom","cat","dog","ham","mat","sat","lot"};
printf("How many games do you want to play? ");
scanf("%d",&howmany);
for(j=0;j<howmany;j++)
{printf("Choose a word from these choices: ");
   for(i=0;i<10;i++)
      printf("%s ",choices[i]);
   printf(" ");
   scanf("%s",&person);
   len=strlen(person);
     while(len!=3)
      {printf("Bad choice ");
       printf("choose one of thevalid choices: ");
       scanf("%s",&person);
       len=strlen(person);
       }
       i=rand()%9+1;
    strncpy(computer,choices[i],4);
    printf("computer: %s ",computer);
    if(strcmp(person,computer)==0)
       personScore++;
    else
       computerScore++;
}
printf(" Final score: ");
printf("You: %d computer: %d ",personScore,computerScore);
if(personScore>computerScore)
     printf("Congradulation You are TheWinner!!! ");
if(computerScore>personScore)
     printf("computer won!!! ");
if(computerScore==personScore)
     printf("TIE game! ");
        
getch();
return 0;
}
_____________________________________________________________________________

warning C4244: 'function' : conversion from'time_t' to 'unsigned int', possible loss of data

: error C2143: syntax error : missing ';' before 'type'

error C2109: subscript requires array or pointer type

: error C2065: 'choices' : undeclared identifier

error C2109: subscript requires array or pointer type

warning C4047: 'function' : 'const char *' differs in levelsof indirection from 'int'

warning C4024: 'strncpy' : different types for formal andactual parameter 2

error C2198: 'strncpy' : too few arguments forcall


Explanation / Answer

try this and please rate - thanks #include #include #include #include #include int main() {int personScore=0,computerScore=0,len,i,j,k,howmany; char computer[4],person[4]; srand(time(0)); charchoices[10][3]={"hat","sox","dad","mom","cat","dog","ham","mat","sat","lot"}; printf("How many games do you want to play? "); scanf("%d",&howmany); for(j=0;j
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote