Advertisement
Guest User

abhi 12 AAA

a guest
Jan 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <cmath>
  4. #include <ctime>
  5.  
  6. using namespace std;
  7.  
  8. typedef struct cone {
  9. int radius;
  10. int height;
  11. }
  12. CONE;
  13.  
  14. int main()
  15. {
  16. srand(time(NULL));
  17. CONE cones[300];
  18. int bigcone = 0;
  19. for(int j = 0;j<300;j++)
  20. {
  21. cones[j].radius = rand()%100+1;
  22. cones[j].height = rand()%100+1;
  23. if(cones[j].radius * cones[j].height > 1000) bigcone++;
  24. }
  25. cout << "cones with volume > 1000 = " << bigcone << endl;
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement