Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. 1 #include<stdio.h>
  2. 2
  3. 3 int main(void) {
  4. 4
  5. 5 float launchHeight;
  6. 6 int launchAngle;
  7. 7 float launchVelocity;
  8. 8 int test = 1;
  9. 9
  10. 10 printf("Hello and welcome to the Ballistic Calculator v0.0.2! This program is licensed under the GPL V3.0 a nd was written by TuxFuk\n\n");
  11. 11
  12. 12 printf("Changelog\n");
  13. 13 printf("Spelling fixes\n\n");
  14. 14
  15. 15 while (test == 1) {
  16. 16 /* Launch Height Section */
  17. 17 printf("Please enter a height above the ground in meters.\n");
  18. 18
  19. 19 scanf("%f", &launchHeight); /* takes user input and stores it in launchHeight's memory address */
  20. 20 if (launchHeight < 0) {
  21. 21 printf("Input Error: Expected a positive number\n");
  22. 22
  23. 23 }
  24. 24 printf("you did it!\n");
  25. 25 }
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33 printf("\n You entered: %f meters\n", launchHeight);
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43 /* Launch Angle Section */
  44. 44 printf("Please enter a launch angle in degrees \n");
  45. 45
  46. 46 scanf("%d", &launchAngle); /* takes user input and stores it in launchAngle's memory address * /
  47. 47
  48. 48 printf("\n You entered: %d degrees\n", launchAngle);
  49. 49
  50. 50 /* error code: printf("Input Error: Expected an angle between 90 and -90 degrees\n"); */
  51. 51
  52. 52
  53. 53
  54. 54 /* Launch Velocity Section */
  55. 55 printf("Please enter an initial launch velocity in m/s\n");
  56. 56
  57. 57 scanf("%f", &launchVelocity); /* takes user input and stores it in launchVelocity's memory addres s */
  58. 58
  59. 59 printf("\n You entered: %f m/s\n", launchVelocity);
  60. 60
  61. 61 /* error code: printf("Input Error: Expected a positive number\n"); */
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67 return 0;
  68. 68 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement