1. LAB 3 :
  2. Q1: Day of Month :
  3. #include <cmath>
  4. #include <cstdio>
  5. #include <vector>
  6. #include <iostream>
  7. #include <algorithm>
  8. using namespace std;
  9. int main() {
  10. int n;
  11. cin>>n;
  12. if (n==1 || n==3 || n==5 || n==7 || n==8 || n==10 || n==12 )
  13. cout <<"31 days";
  14. if (n==4 || n==6 || n==9 || n==11)
  15. cout <<"30 days";
  16. if (n==2)
  17. cout <<"28 or 29 days";
  18. if (n<1 || n>12)
  19. cout<<"invalid month number";
  20. return 0;
  21. }
  22. -----------------------------------------------------------------------------------------
  23. Q2 : Chess Board Squares Color
  24. #include <cmath>
  25. #include <cstdio>
  26. #include <vector>
  27. #include <iostream>
  28. #include <algorithm>
  29. using namespace std;
  30. int main() {
  31. int n;
  32. char c;
  33. cin>>c>>n;
  34. if ((n%2==0 && c%2==0) || (n%2!=0 && c%2!=0))
  35. cout << "Black";
  36. if ((n%2!=0 && c%2==0) || (n%2==0 && c%2!=0))
  37. cout << "White";
  38. return 0;
  39. }
  40. -----------------------------------------------------------------------------------------
  41. Q3: Calculating Salary bounce
  42. #include <iostream>
  43. #include <string>
  44. using namespace std;
  45. int main() {
  46. double a;
  47. string b;
  48. cin >>a>>b;
  49. if (a>=0)
  50. {
  51. if (b=="manager")
  52. cout << (a + (1.0/5.0)*a) ;
  53. if (b=="programmer" )
  54. cout << a + (15.0/100.0)*a ;
  55. if (b=="financial" )
  56. cout << a + (1.0/10.0)*a ;
  57. if (b=="other" )
  58. cout << a + (1.0/20.0)*a ;
  59. }
  60. return 0;
  61. }
  62. JEBRIL_MEJDALAWI <3 JCE
Comments powered by Disqus