fork download
  1. #include <iostream>
  2.  
  3. int main(todaysDate, numberOfSchoolDaysLeftUntilSummer)
  4.  
  5. {
  6.  
  7. //Below are two strings that can hold several char variables
  8.  
  9. char todaysMonth[10];
  10. char lastMonthOfSchool[10];
  11.  
  12. //Below are variables where the month will be written in number //form.
  13. //The char variables are converted into integers so numerical //calculations on the months can be performed.
  14.  
  15. short numberMonth = 0;
  16. short numberLastMonth = 0;
  17. short monthsLeft;
  18.  
  19. std::cout << "What is the month of today\t?";
  20. std::cin >> todaysMonth;
  21. std::cout << "\nWhat month does school end?\t";
  22. std::cin << lastMonthOfSchool;
  23.  
  24.  
  25.  
  26. switch (todaysMonth)
  27. {
  28. case january:
  29. numberMonth + 1;
  30. break;
  31. case february:
  32. numberMonth + 2;
  33. break;
  34. case march:
  35. numberMonth + 3;
  36. break;
  37. case april:
  38. numberMonth + 4;
  39. break;
  40. case may:
  41. numberMonth + 5;
  42. break;
  43. case june:
  44. numberMonth + 6;
  45. break;
  46. case july:
  47. numberMonth - 6;
  48. break;
  49. case august:
  50. numberMonth - 5;
  51. break;
  52. case september:
  53. numberMonth - 4;
  54. break;
  55. case october:
  56. numberMonth - 3;
  57. break;
  58. case november
  59. numberMonth - 2;
  60. break;
  61. case december:
  62. numberMonth - 1;
  63. break;
  64. case default:
  65. std::cout << "\nError: Please try again and enter a month without any capital letters";
  66. }
  67.  
  68.  
  69. switch (lastMonthOfSchool)
  70. {
  71. case january:
  72. numberLastMonth + 1;
  73. break;
  74. case february:
  75. numberLastMonth + 2;
  76. break;
  77. case march:
  78. numberLastMonth + 3;
  79. break;
  80. case april:
  81. numberLastMonth + 4;
  82. break;
  83. case may:
  84. numberLastMonth + 5;
  85. break;
  86. case june:
  87. numberLastMonth + 6;
  88. break;
  89. case july:
  90. numberLastMonth - 6;
  91. break;
  92. case august:
  93. numberLastMonth - 5;
  94. break;
  95. case september:
  96. numberLastMonth - 4;
  97. break;
  98. case october:
  99. numberLastMonth - 3;
  100. break;
  101. case november
  102. numberLastMonth - 2;
  103. break;
  104. case december:
  105. numberLastMonth - 1;
  106. break;
  107. case default:
  108. std::cout << "\nError: Please try again and enter a month without any capital letters.";
  109. }
  110.  
  111. //The statement below calculates how many months are left
  112.  
  113. numberLastMonth - numberMonth = monthsLeft;
  114.  
  115. //If the statement above assigns the variable monthsLeft a negative //number, then the statement below makes it the correct, positive //number
  116.  
  117. if (monthsLeft < 0)
  118. {
  119. switch (monthsLeft)
  120. {
  121. case = -1:
  122. monthsLeft + 1;
  123. break;
  124. case = -2:
  125. monthsLeft + 4;
  126. break;
  127. case = -3:
  128. monthsLeft + 6;
  129. break;
  130. case = -4:
  131. monthsLeft + 8;
  132. break;
  133. case = -5:
  134. monthsLeft + 10;
  135. break;
  136. case = -6:
  137. monthsLeft + 12;
  138. break;
  139. case = -7:
  140. monthsLeft + 14;
  141. break;
  142. case = -8:
  143. monthsLeft + 16;
  144. break;
  145. case = -9:
  146. monthsLeft + 18;
  147. break;
  148. case = -10:
  149. monthsLeft + 20;
  150. break;
  151. case = -11:
  152. monthsLeft + 22;
  153. break;
  154. case = -12:
  155. monthsLeft + 24;
  156. break;
  157. case default:
  158. std::cout << "\nError: Please try again and enter a month.";
  159. break;
  160. }
  161. }
  162.  
  163. //These are the variables that store today's date and the date of the //last day of school
  164.  
  165. short todaysDate;
  166. short lastDate;
  167. int daysLeftEstimate;
  168.  
  169. if (monthsLeft<=2)
  170. {
  171. std::cout << "\nEnter in today's date\t";
  172. std::cin >> todaysDate;
  173.  
  174. std::cout << "\nEnter in the date of the last day of school\t";
  175. std::cin >> lastDate;
  176.  
  177. monthsLeft * 20 = daysLeftEstimate;
  178. lastDate - todaysDate -((lastDate - todaysDate)/7*2) = numberOfSchoolDaysLeftUntilSummer;
  179. }
  180.  
  181. if (monthsLeft <= 5 && monthsLeft >= 3)
  182. {
  183. std::cout << "\nEnter in today's date\t";
  184. std::cin >> todaysDate;
  185.  
  186. std::cout << "\nEnter in the date of the last day of school\t";
  187. std::cin >> lastDate;
  188.  
  189. monthsLeft * 18.8 = daysLeftEstimate;
  190. lastDate - todaysDate -((lastDate - todaysDate)/7*2) = numberOfSchoolDaysLeftUntilSummer;
  191. }
  192.  
  193. if (monthsLeft = 6)
  194. {
  195. std::cout << "\nEnter in today's date\t";
  196. std::cin >> todaysDate;
  197.  
  198. std::cout << "\nEnter in the date of the last day of school\t";
  199. std::cin >> lastDate;
  200.  
  201. monthsLeft * 18.17 = daysLeftEstimate;
  202. lastDate - todaysDate -((lastDate - todaysDate)/7*2) = numberOfSchoolDaysLeftUntilSummer;
  203. }
  204.  
  205. if (monthsLeft = 7)
  206. {
  207. std::cout << "\nEnter in today's date\t";
  208. std::cin >> todaysDate;
  209.  
  210. std::cout << "\nEnter in the date of the last day of school\t";
  211. std::cin >> lastDate;
  212.  
  213. monthsLeft * 17.71 = daysLeftEstimate;
  214. lastDate - todaysDate -((lastDate - todaysDate)/7*2) = numberOfSchoolDaysLeftUntilSummer;
  215. }
  216.  
  217. if (monthsLeft = 8)
  218. {
  219. std::cout << "\nEnter in today's date\t";
  220. std::cin >> todaysDate;
  221.  
  222. std::cout << "\nEnter in the date of the last day of school\t";
  223. std::cin >> lastDate;
  224.  
  225. monthsLeft * 18.25 = daysLeftEstimate;
  226. lastDate - todaysDate -((lastDate - todaysDate)/7*2) = numberOfSchoolDaysLeftUntilSummer;
  227. }
  228.  
  229. std::cout << "\nThere are: " << numberOfSchoolDaysLeftUntilSummer << "days left until it is summer time. \n Estimation: \t" << daysLeftEstimation;
  230. return 0;
  231.  
  232. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
april
june
20
3
compilation info
prog.cpp:3:10: error: ‘todaysDate’ was not declared in this scope
 int main(todaysDate, numberOfSchoolDaysLeftUntilSummer)
          ^
prog.cpp:3:22: error: ‘numberOfSchoolDaysLeftUntilSummer’ was not declared in this scope
 int main(todaysDate, numberOfSchoolDaysLeftUntilSummer)
                      ^
prog.cpp:3:55: error: expression list treated as compound expression in initializer [-fpermissive]
 int main(todaysDate, numberOfSchoolDaysLeftUntilSummer)
                                                       ^
prog.cpp:5:1: error: expected ‘,’ or ‘;’ before ‘{’ token
 {
 ^
stdout
Standard output is empty