CS计算机代考程序代写 #include

#include
#include
#include
#include
#include

#define MAX_COUNT 7

int main()
{
pid_t ret_val;
pid_t pid;
int i, j;

ret_val = fork();

if (ret_val < 0) { printf("Error on fork.\n"); exit (1); } pid = getpid(); for(i=1; i <= MAX_COUNT; i++){ if (ret_val > 0) {
/* usleep (100000); */
for (j = 0; j <= 3500; ++j) { printf(""); /*print null string*/ } printf("*This line is from pid %d, value = %d\n", pid, i); } else { printf("*This line is from pid %d, value = %d\n", pid, i+8); } } return (0); }