COP 3223C Lecture 16: COP 10:3

60 views2 pages
5 Oct 2016
School
Course
Professor

Document Summary

Can generate an integer using rand and assign it to an integer variable. Use % with values generated with rand. Rand()%10 would provide this number but also 0 which is not needed. We can add 1 and use rand()%10 + 1. But now there is a possibility of generating 10. To take care of both end points. Numbers are pseudo random, always will be the same. Force numbers to be chosen from a different starting point with srand. Srand is utilized before the random number and always once. Programs have been limited to user input via console and output of results to screen. This does not allow us to store results. To store results we need les, available even after the program is nished. Files can also be used to provide input. This is how real world programs work. Initialize the le pointer to point to the address of the le.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents