Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

Identify the elements that make up the employee reward package.

Answered: 1 week ago

Question

Understand the purpose, value and drawbacks of the interview.

Answered: 1 week ago