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

Code these three functions and write a driver program to run & test these functi

ID: 3535107 • Letter: C

Question

 Code these three functions and write a  driver program to run & test these functions to see that they  do what they are supposed to do. Fix the broken one.

void strcpy(char dest[ ], char src[ ]) { int i = 0; while(src[i] != ‘’){ dest[i] = src[i]; i++; } dest[i] = ‘’; return; } char [ ] strcpy(char dest[ ], char src[ ]) { int i = 0; while(src[i] != ‘’){ dest[i] = src[i]; i++; } dest[i] = ‘’; return dest; } char grade(float p) { char c; if(p >= 90.0) c = ‘A’; else if(p >= 80.0) c = ‘B’; else if(p >= 70.0) c = ‘C’; else if(p >= 60.0) c = ‘D’; else c = ‘F’; return c; }
If the functions don't show up correctly email me at Maspapayas@aol.com and I can send you the full functions.
void strcpy(char dest[ ], char src[ ]) { int i = 0; while(src[i] != ‘’){ dest[i] = src[i]; i++; } dest[i] = ‘’; return; } char [ ] strcpy(char dest[ ], char src[ ]) { int i = 0; while(src[i] != ‘’){ dest[i] = src[i]; i++; } dest[i] = ‘’; return dest; } char grade(float p) { char c; if(p >= 90.0) c = ‘A’; else if(p >= 80.0) c = ‘B’; else if(p >= 70.0) c = ‘C’; else if(p >= 60.0) c = ‘D’; else c = ‘F’; return c; }

Explanation / Answer

Please rate only the best answer....pls rate with 5 ....a fully working code with the driver program:


#include <stdio.h>



void strcpy1(char dest[], char src[])

{

int i = 0;

while(src[i] != ''){

dest[i] = src[i];

i++;

}

dest[i] = '';

return;

}


char* strcpy(char dest[], char src[])

{

int i = 0;

while(src[i] != ''){

dest[i] = src[i];

i++;

}

dest[i] = '';

return dest;

}


char grade(float p)

{

char c;

if(p >= 90.0)

c = 'A';

else if(p >= 80.0)

c = 'B';

else if(p >= 70.0)

c = 'C';

else if(p >= 60.0)

c = 'D';

else

c = 'F';

return c;

}


main()

{

char *a="chegg";

char b[10];

strcpy1(b,a);

printf("%s",b);

printf(" ");

float marks=85;

char grad=grade(marks);

printf("Grade is %c ",grad);


}



You can also check here:

http://ideone.com/liX9VA