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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started