Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <conio.h>
- #include <ctime>
- using namespace std;
- typedef struct box {
- double high;
- double width;
- double length;
- box *next;
- } BOX;
- void create_a_box(BOX *p) {
- srand(time(NULL));
- p->high = rand()%100+1;
- p->width = rand()%100+1;
- p->length = rand()%100+1;
- }
- void add_to_the_list(BOX *start) {
- BOX *t1=start;
- while(1) {
- if (t1->next=NULL) break;
- t1 = t1-> next;
- }
- BOX *newbox = new BOX;
- t1 -> next = newbox;
- newbox -> next = NULL;
- create_a_box(newbox);
- }
- double volume(BOX box) {
- return box.high*box.length*box.width;
- }
- void display_box(BOX box) {
- cout<<endl<<box.high<<endl<<box.length<<endl<<box.width<<endl;
- }
- int main()
- {
- // BOX box1;
- // create_a_box(&box1);
- // display_box(box1);1
- for (int i;i<10;i++) {
- BOX box[i];
- create_a_box(&box[i]);
- display_box(box[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement