Question: /* Change this program so that it finishes in 1 second (by changing the usleep), draws -v-/ rather than x, and each time it bounces

/* Change this program so that it finishes in 1 second (by changing the usleep), draws \-v-/ rather than x, and each time it "bounces" from position 0 it increases by 10 the limit on the right for the position before it bounces back. */ #include #include #include #include

int main(int argc, char *argv[]) {

int pos = 10, dir = 1; for(int i=0; i < 100; i++) { usleep(10000); printf("%*s ", pos, "\\-v-/"); pos = pos + 1 * dir; if (pos > 20) { dir = -1; } else if (pos-strlen("x") <= 0) { dir = 1;

} }

return 0; }

**Need the code modified or updated**

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!