Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.08 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int yos;
  5. double salary;
  6. char time;
  7.  
  8. printf("Please enter your employee status, 'P' for Fulltime and 'P' for Parttime: n");
  9. scanf_s("%c", &time);
  10. printf("Please enter your year of service: n");
  11. scanf_s("%d", &yos);
  12. printf("Please enter your current salary: n");
  13. scanf_s("%lf", &salary);
  14.  
  15. switch (time)
  16. {
  17. case 'F':
  18. case 'f':
  19. if (yos >= 5)
  20. {
  21. salary = (salary*5.0 / 100.0) + salary;
  22. printf("nYour new salary is %.2lf", salary);
  23. }
  24. else if (yos < 5 )
  25. {
  26. salary = (salary*4.0 / 100.0) + salary;
  27. printf("nYour new salary is %.2lf", salary);
  28. }
  29. break;
  30.  
  31. case 'P':
  32. case 'p':
  33. if (yos >= 5)
  34. {
  35. salary = (salary*3.0 / 100.0) + salary;
  36. printf("nYour new salary is %.2lf", salary);
  37. }
  38. else if (yos < 5 )
  39. {
  40. salary = (salary*2.5 / 100.0) + salary;
  41. printf("nYour new salary is %.2lf", salary);
  42. }
  43. break;
  44. default:
  45. printf("Please put the details correctlyn");
  46. }
  47.  
  48. return(0);
  49. }
  50.  
  51. Please enter your employee status, 'P' for Fulltime and 'P' for Parttime:
  52. F
  53. Please enter your year of service:
  54. 6
  55. Please enter your current salary:
  56. 200
  57. Please put the details correctly
  58. Press any key to continue
  59.  
  60. #include<stdio.h>
  61. int main()
  62. {
  63. int yos;
  64. double salary;
  65. char time;
  66.  
  67. printf("Please enter your employee status, 'P' for Fulltime and 'P' for Parttime: n");
  68. scanf_s("%c", &time);
  69. printf("Please enter your year of service: n");
  70. scanf_s("%d", &yos);
  71. printf("Please enter your current salary: n");
  72. scanf_s("%lf", &salary);
  73.  
  74. if (char time == 'F' && yos >= 5)
  75. {
  76. salary = (salary*5.0 / 100.0) + salary;
  77. printf("nYour new salary is %.2lf", salary);
  78. }
  79.  
  80. else if (char time == 'F' && yos < 5)
  81. {
  82. salary = (salary*4.0 / 100.0) + salary;
  83. printf("nYour new salary is %.2lf", salary);
  84. }
  85.  
  86. if (char time == 'P' && yos >= 5)
  87. {
  88. salary = (salary*3.0 / 100.0) + salary;
  89. printf("nYour new salary is %.2lf", salary);
  90. }
  91.  
  92. else if (char time == 'P' && yos < 5)
  93. {
  94. salary == (salary*2.5 / 100.0) + salary;
  95. printf("nYour new salary is %.2lf", salary);
  96. }
  97. return(0);
  98. }
  99.  
  100. error c2143 missing ',' before '==' at line 15, 21, 27...
  101.  
  102. Warning 11 warning C4553: '==' : operator has no effect; did you intend '='?
  103.  
  104. #include<stdio.h>
  105.  
  106. int main() {
  107. int yos;
  108. double salary;
  109. char time;
  110.  
  111. printf("Please enter your employee status, 'F' for Fulltime and 'P' for Parttime: n");
  112. scanf("%c", &time);
  113. printf("Please enter your year of service: n");
  114. scanf("%d", &yos);
  115. printf("Please enter your current salary: n");
  116. scanf("%lf", &salary);
  117.  
  118. switch (time) {
  119. case 'F':
  120. case 'f':
  121. if (yos >= 5) {
  122. salary = (salary * 5.0 / 100.0) + salary;
  123. printf("nYour new salary is %.2lf", salary);
  124. }
  125. else if (yos < 5) {
  126. salary = (salary * 4.0 / 100.0) + salary;
  127. printf("nYour new salary is %.2lf", salary);
  128. }
  129. break;
  130.  
  131. case 'P':
  132. case 'p':
  133. if (yos >= 5) {
  134. salary = (salary * 3.0 / 100.0) + salary;
  135. printf("nYour new salary is %.2lf", salary);
  136. }
  137. else if (yos < 5) {
  138. salary = (salary * 2.5 / 100.0) + salary;
  139. printf("nYour new salary is %.2lf", salary);
  140. }
  141. break;
  142. default:
  143. printf("Please put the details correctlyn");
  144. }
  145.  
  146. return (0);
  147. }
  148.  
  149. Please enter your employee status, 'F' for Fulltime and 'P' for Parttime:
  150. F
  151. Please enter your year of service:
  152. 6
  153. Please enter your current salary:
  154. 200
  155.  
  156. Your new salary is 210.00
  157.  
  158. #include<stdio.h>
  159. int main()
  160. {
  161. int yos;
  162. double salary;
  163. char time;
  164.  
  165. printf("Please enter your employee status, 'P' for Fulltime and 'P' for Parttime: n");
  166. scanf("%c", &time);
  167. printf("Please enter your year of service: n");
  168. scanf("%d", &yos);
  169. printf("Please enter your current salary: n");
  170. scanf("%lf", &salary);
  171.  
  172. if (time == 'F' && yos >= 5)
  173. {
  174. salary = (salary*5.0 / 100.0) + salary;
  175. printf("nYour new salary is %.2lf", salary);
  176. }
  177.  
  178. else if (time == 'F' && yos < 5)
  179. {
  180. salary = (salary*4.0 / 100.0) + salary;
  181. printf("nYour new salary is %.2lf", salary);
  182. }
  183.  
  184. if (time == 'P' && yos >= 5)
  185. {
  186. salary = (salary*3.0 / 100.0) + salary;
  187. printf("nYour new salary is %.2lf", salary);
  188. }
  189.  
  190. else if (time == 'P' && yos < 5)
  191. {
  192. salary == (salary*2.5 / 100.0) + salary;
  193. printf("nYour new salary is %.2lf", salary);
  194. }
  195. return(0);
  196. }
  197.  
  198. #include<stdio.h>
  199. int main()
  200. {
  201. int yos;
  202. double salary;
  203. char time;
  204.  
  205. printf("Please enter your employee status, 'F' for Fulltime and 'P' for Parttime: n");
  206. scanf("%c", &time);
  207. printf("Please enter your year of service: n");
  208. scanf("%d", &yos);
  209. printf("Please enter your current salary: n");
  210. scanf("%lf", &salary);
  211.  
  212. int status;
  213. if(time=='F'||time=='f')
  214. status = 1;
  215. if(time=='P'||time=='p')
  216. status = 2;
  217. switch (status)
  218. {
  219. case 1:
  220. if (yos >= 5)
  221. {
  222. salary = (salary*5.0 / 100.0) + salary;
  223. printf("nYour new salary is %.2lf", salary);
  224. }
  225. else if (yos < 5 )
  226. {
  227. salary = (salary*4.0 / 100.0) + salary;
  228. printf("nYour new salary is %.2lf", salary);
  229. }
  230. break;
  231.  
  232. case 2:
  233. if (yos >= 5)
  234. {
  235. salary = (salary*3.0 / 100.0) + salary;
  236. printf("nYour new salary is %.2lf", salary);
  237. }
  238. else if (yos < 5 )
  239. {
  240. salary = (salary*2.5 / 100.0) + salary;
  241. printf("nYour new salary is %.2lf", salary);
  242. }
  243. break;
  244. default:
  245. printf("Please put the details correctlyn");
  246. }
  247.  
  248. return(0);
  249. }
  250.  
  251. char c;
  252.  
  253. scanf_s("%c", &c, 1);
  254.  
  255. scanf_s("%c", &time, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement