Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program is in C. How can I use the rand function to limit the random string to characters a-z, A-Z, or 0-9 by using

image text in transcribed

The program is in C. How can I use the rand function to limit the random string to characters a-z, A-Z, or 0-9 by using ASCII?

Also how can I store the HexValues? I'm planning on keeping a minHexValue and maxHexValue to display the largest and smallest numbers

In this project, each student is to write a program that produces and checks a random string of letters and numbers. The student should gain a better understanding of: Strings String Function(s) rand() Operation You are to write a program that creates one thousand strings of 128 random characters and numbers, one at a time, and stored in a character array str[129]. The program should use rand() to store either a letter ( 'A' to 'Z' and 'a' to 'z') or digit ('0' to '9') at all 128 positions in the string. You should use the results of rand() in such a way that there should be about an equal probability of each position in the string being either a letter or a digit. After creating each new string, your program should display the first n characters which are all valid hexadecimal digits and print out the decimal equivalent for the hex digits. Your program should also display at completion the largest and smallest hexadecimal numbers that your program created from a continuous sequence of the first n characters of each string. For example, if your program generated the string str="12A7C4J23EF9MQ2..." on the seventh loop, you should display something like HexValue [7] = 0x12A7C4 = 1,222,596 Decimal

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions