Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
For the scramble.c problem, write a program that:
• Has a main () function and another function that has this prototype:
void scramble str (char s[]);
• The scramble_str() function scrambles the contents of the string in a random way so that the string has the same
length as before, but the contents are all mixed around. It does this in-place, i.e., there is only one buffer that holds a
string. You're free to scramble it any way you want to, but use rand () repeatedly so it gets really scrambled.
• The main () function will read a string entered by the user into the buffer, call scramble_str(), and output the
resulting string. This will be done in a loop forever, until the entered string is the string "bye". When the user says "bye",
the program will exit with a polite message.
Do note that reading a string using scanf (), which is the only tool I've introduced you to so far, will just read up to the
first whitespace. So, multiple-word strings won't work! Let's use something that will read up to a newline character:
gets (). See the supplemental note and an example below.
Make the buffer 50 characters big.
expand button
Transcribed Image Text:For the scramble.c problem, write a program that: • Has a main () function and another function that has this prototype: void scramble str (char s[]); • The scramble_str() function scrambles the contents of the string in a random way so that the string has the same length as before, but the contents are all mixed around. It does this in-place, i.e., there is only one buffer that holds a string. You're free to scramble it any way you want to, but use rand () repeatedly so it gets really scrambled. • The main () function will read a string entered by the user into the buffer, call scramble_str(), and output the resulting string. This will be done in a loop forever, until the entered string is the string "bye". When the user says "bye", the program will exit with a polite message. Do note that reading a string using scanf (), which is the only tool I've introduced you to so far, will just read up to the first whitespace. So, multiple-word strings won't work! Let's use something that will read up to a newline character: gets (). See the supplemental note and an example below. Make the buffer 50 characters big.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education