0

How to write a function to generate a new Book with random arguments(name, pages, price)

struct Book { string name; int pages; int price; }; int randStudent() { }

15th Jan 2021, 3:27 PM
zaya1235
zaya1235 - avatar
4 Réponses
+ 2
zaya1235 is there any initial data for the name ,pages and price of book? Because it doesn't makes sense to generate a random book name "cydzs" with some random price and pages .
15th Jan 2021, 4:19 PM
Abhay
Abhay - avatar
0
Abhay i think you should enter name manually. Pages and price should be in some kind of range. Like up to 1000 pages and price up to 300
15th Jan 2021, 6:13 PM
zaya1235
zaya1235 - avatar
0
Abhay so basically later you create an array of book and fill it by using that function
15th Jan 2021, 6:18 PM
zaya1235
zaya1235 - avatar
0
zaya1235 so what do you want to do in actual? Can you give an example program with possible inputs and outputs ? Also please show us the code you have attempted so far ,for me it is difficult to figure out what you are really looking for .
15th Jan 2021, 7:28 PM
Abhay
Abhay - avatar