- LAB 3 :
- Q1: Day of Month :
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int n;
- cin>>n;
- if (n==1 || n==3 || n==5 || n==7 || n==8 || n==10 || n==12 )
- cout <<"31 days";
- if (n==4 || n==6 || n==9 || n==11)
- cout <<"30 days";
- if (n==2)
- cout <<"28 or 29 days";
- if (n<1 || n>12)
- cout<<"invalid month number";
- return 0;
- }
- -----------------------------------------------------------------------------------------
- Q2 : Chess Board Squares Color
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int n;
- char c;
- cin>>c>>n;
- if ((n%2==0 && c%2==0) || (n%2!=0 && c%2!=0))
- cout << "Black";
- if ((n%2!=0 && c%2==0) || (n%2==0 && c%2!=0))
- cout << "White";
- return 0;
- }
- -----------------------------------------------------------------------------------------
- Q3: Calculating Salary bounce
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- double a;
- string b;
- cin >>a>>b;
- if (a>=0)
- {
- if (b=="manager")
- cout << (a + (1.0/5.0)*a) ;
- if (b=="programmer" )
- cout << a + (15.0/100.0)*a ;
- if (b=="financial" )
- cout << a + (1.0/10.0)*a ;
- if (b=="other" )
- cout << a + (1.0/20.0)*a ;
- }
- return 0;
- }
- JEBRIL_MEJDALAWI <3 JCE