EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff

Training Missions

Read Me First
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Captcha Cracking
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom
/dev/extra

Knowledge Bank

Discussion Forums
Exploit Database New
PasteBin New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Downloads
Tools

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Pimp Us Out!

Review enigmagroup.org on alexa.com

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.

Enigma Group

Enigma Group

Enigma Group

Enigma Group

 

Affiliates



The Urinal

hackhound.org

suck-o.com

hack.org.za

flyninja.net

 

Enigma Group's Code Bank


Tins in a box

By: mofm  -  Date Submitted: 2009-07-25 17:43:58

  1. #include <stdio.h> //header files
  2. #include <stdlib.h> //header files
  3.  
  4. float cyl_diameter,cyl_height,cyl_radius,cyl_radius2,cyl_answer,cyl_vol,total_cyl_vol,waste //Cylinder variables
  5. float cont_height,cont_width,cont_lenght,cont_area,cont_vol,cont_answer //Container variables
  6. int fitinbox
  7. char buff[20]//buffer
  8. float cylinder_vol (float cyl_height,float cyl_diameter) //Work out
  9. {
  10. cyl_radius = cyl_diameter / 2 // calculate radius
  11. cyl_radius2 = cyl_radius*cyl_radius //calculate radius squared
  12. cyl_answer= 3.14*cyl_radius2*cyl_height//calculate volume
  13. return cyl_answer//return area to main function
  14.  
  15. }
  16.  
  17. float container_vol(float lenght,float height,float width) //works out the container volume
  18. {
  19. cont_answer= lenght*height*width
  20. return cont_answer
  21. }
  22. int amount_fits(float diameter,float lenght,float width,float height) //works out the amount of cylinders that fits in a box
  23. {
  24. int answer
  25. answer = (int)(lenght / diameter) * (int)(width / diameter) * (int)(height / cyl_height)
  26. return answer
  27. }
  28. void main ()
  29. {
  30. do{
  31. printf ("Enter the height of the Cylinder in CM: ")
  32. cyl_height = atof(gets(buff))
  33. if (cyl_height <=0)
  34. {
  35. printf("Height Entered is To low.\n")
  36. }
  37. }while(cyl_height <=0)
  38. do{
  39. printf ("Enter the diameter of the Cylinder in CM: ")
  40. cyl_diameter = atof(gets(buff))
  41. if (cyl_diameter <=0)
  42. {
  43. printf("Diameter Entered is To low.\n")
  44. }
  45. }while(cyl_diameter <=0)
  46. do{
  47. printf ("Enter the Width of the box in CM: ")
  48. cont_width = atof(gets(buff))
  49. if (cont_width <=0)
  50. {
  51. printf("Width Entered is To low.\n")
  52. }
  53. }while(cont_width <=0)
  54. do{
  55. printf ("Enter the Length of the box in CM: ")
  56. cont_lenght = atof(gets(buff))
  57. if (cont_lenght <=0)
  58. {
  59. printf("lenght Entered is To low.\n")
  60. }
  61. }while(cont_lenght <=0)
  62. do{
  63. printf ("Enter the Height of the box in CM: ")
  64. cont_height = atof(gets(buff))
  65. if (cont_height <=0cyl_height > cont_height)
  66. {
  67. printf("Height Entered is To low.\n")
  68. }
  69. }while(cont_height <=0cyl_height > cont_height)
  70. /*The above code Gets input from user and makes sure the input is above 0 if not it will
  71. tell the use thir is an error and show the input prompt again*/
  72.  
  73. cyl_vol = cylinder_vol(cyl_height,cyl_diameter) // calls function to work out cylinder volume
  74. cont_vol= container_vol(cont_lenght,cont_height,cont_width)//calls function to work out container volume
  75. fitinbox = amount_fits(cyl_diameter, cont_lenght, cont_width, cont_height)
  76. // above calls function to work out the amount of tins that fit in a box
  77. total_cyl_vol = cyl_vol * fitinbox // this works out the total volume used inside the box by the tins
  78. waste = cont_vol - total_cyl_vol //this takes the total volume used by the tins and takes it from the box volume
  79.  
  80. printf("You can fit %d cylinders in box\n",fitinbox) //Shows user the program output
  81. printf ("The waste volume is: %2.2f CM3\n",waste)
  82.  
  83.  
  84. }
  85.  
Return to ajax category list

Who Visited EnigmaGroup Today?

1581 Guests, 270 Users (182 Spiders)
limited, Hessesian, whisperer, whoami, hackaday, Rex_Mundi, trueorfalse, strudels, Bumpadjuppy, DrOptix, Klosse, InjectioN, blackknight911, Effomeidonize, Distorted, JohnMalkovitzch, TheHarrisonW, Obop, hkevin, ellisp, Vreality2007, advenlydent, zach, ddxc, suetekh, Vengeance987, m0rt, 2345, electro-technic, riesenjoe, IvanDimitriev, nmobin27, RomeoG, timetrust, 2142, 3ntr0py, BillTuer, advilapyday, lotato, lonely.connection, CloverCipher, vnd, aurena, rospark, valy1177, Blavatsky, learning, st3alth, Partisan, K0gller, fitz, Jayjay, psychomarine, Vspectrum, San Marino, TinCardinal, brunoriversyhn, code-g, yshiau, Psiber_Syn, Seasharp, obencefoozy, SlayingDragons, Link-, tinuigimeni, jasonbourne, Fred, GothicLogic, somebody777, Meonkzt, CJ_Omaha, jearrorne, cls777, unsugsNashy, Balksnuntails, Sir D. Naut, batsbargy, Rik, Macabre, Nightraven, Iccyx, Repuhlsive, vipervince2002, Janomatrix, lol, veceattainc, techno, Exclaw, Nikhil, evjfvir967nj, Mod777, dark_void, nermtode, Tjm, bjy1997, hecky, saraf, elprof, damoniceht, trik, jordan86, SnoopSky, dan_movie, OnetInsolefon, darkfire1515, seojlhmyrhwh, Thoplehap, MaxMeier, 1028rajeev, Abhinav2107, autotuneuser, alexelixir, Tauya, Jozinbrejl, kernel_mod, quolc, anandoump, vladavlada, Taicadine, AnnaNoult, GreenTiger, baripadatimes, Ewing, Blackbeard, thepuppeteer, BON-SELE, hak4r, Unotohumsmush, NIGHTWOLF, m4f10, avacraft, becool, thecoder, n01se, alpha1, saki, ObesseJew, ActictGlync, sajan, unicornrainbow, Domihoolbob, matt.14, max66, SnowFury, Spud101, myfabregas, Ausome1, kajman121, Frudopvia, ideveloper6, OLOLO, Bugshuppy, lamb, VagWirura, LialiTiTviors, Ordeptpen, scifics, Pozycj-Z21, Gkjt, interPuscruse, aaftab, TheCheeseDemon, blackcyxx21, jollyjimbo, N4g4c3N, rineDriekly, Rap70r, Xargos, flarornEral, ovetz13, sonu sahu, Breezy, emitleBen, Hackpad, JWTSR, nicyun, kaizo, itevainee, luke460, AverageJoe, zeratu92, litbk, Mr.Pickle, mannavard1611, LoopyLion, NexusVos, mtroscheck, burberrybagsjr, nikedunksxm, xordux, jeho, Lonewolf034, Dragonite, nhorton, Reloaded, Odile, Kaptain_k1rk, Teefelltugh, grizzly, posthuman01, jakesboy2, pwnpwnlolz, Sabo, Lakhoamnmek, Røgue, dot_Cipher, mori, snickerless1, cart1m, Xendz, KELATALFTUS, hubris, Afrika, welepocourl, carpinteyrofbt, ReottphoffBom, Reahastegah, pumashoesld, pdanielt, dmac006, DnA-Ender, Red Fox, couptupleakb, ryanjcrook, iMaxx, sh3llcod3, TimHortons, EmilaHapsaums, Feld Grau, burgeoningneophyte, Maroonhat, CookieAu, tinkansinar, Mitodina, timberlandoutletlufc, zsefvy, guccioutletox, AlexDiru, AbercrombieFitchhl, Ryuske, r0z4, slchill, kalak55, Ph4Kt480ii, beefarn, Jigoku, WrossyJes, pollolololo, ZepSung, Fragility, jell0, C9019, Othrguy, Noticon, KIKNWING, llasarus, mdubz, leah027, iellswo, MAZI_, Estilaamoli, subtentar, Trollorful, no, nas0151, Traybo, howisthechicken, thethird3y3, Somethingclever, marplusz
 
Enigma Group